diff --git a/frontend/src/adk/client.ts b/frontend/src/adk/client.ts index ecfae5f6..a7a8435b 100644 --- a/frontend/src/adk/client.ts +++ b/frontend/src/adk/client.ts @@ -409,6 +409,9 @@ export class RuntimeProbeError extends Error { } } +const PRIVATE_RUNTIME_UNREACHABLE_MESSAGE = + "Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。"; + async function runtimeProxyErrorCode(response: Response): Promise { try { const payload = (await response.clone().json()) as { @@ -434,6 +437,12 @@ export async function fetchRemoteApps( if (ep?.runtimeId && runtimeErrorCode === "runtime_access_denied") { throw new RuntimeAccessDeniedError(); } + if ( + ep?.runtimeId && + runtimeErrorCode === "runtime_private_endpoint_unreachable" + ) { + throw new RuntimeProbeError(PRIVATE_RUNTIME_UNREACHABLE_MESSAGE); + } if (ep?.runtimeId && res.status === 404) { throw new RuntimeProbeError( "该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。", diff --git a/frontend/tests/studioAccess.test.mjs b/frontend/tests/studioAccess.test.mjs index d6e1174e..65ff7ffc 100644 --- a/frontend/tests/studioAccess.test.mjs +++ b/frontend/tests/studioAccess.test.mjs @@ -11,6 +11,10 @@ const connectionsSource = read("adk/connections.ts"); const selectorSource = read("ui/AgentSelector.tsx"); const sidebarSource = read("ui/Sidebar.tsx"); const stylesSource = read("styles.css"); +const cliFrontendSource = readFileSync( + new URL("../../veadk/cli/cli_frontend.py", import.meta.url), + "utf8", +); test("Studio access fails closed until the server-derived role is known", () => { assert.match(clientSource, /export type StudioRole = "admin" \| "developer" \| "user"/); @@ -54,6 +58,13 @@ test("runtime selection obeys the server-granted scope", () => { test("runtime authorization failures are not reported as unsupported", () => { assert.match(clientSource, /response\.clone\(\)\.json\(\)/); assert.match(clientSource, /runtime_access_denied/); + assert.match(clientSource, /runtime_private_endpoint_unreachable/); + assert.match(clientSource, /Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime/); + assert.match(cliFrontendSource, /endpoint_network_type == "private"[\s\S]*?runtime_private_endpoint_unreachable/); + assert.match(cliFrontendSource, /def _runtime_proxy_should_retry_probe[\s\S]*?normalized == "list-apps"[\s\S]*?normalized\.startswith\("web\/agent-info\/"\)/); + assert.match(cliFrontendSource, /parts\[0\] == "apps"[\s\S]*?parts\[2\] == "users"[\s\S]*?parts\[4\] == "sessions"/); + assert.match(cliFrontendSource, /max_attempts = 10 if retry_probe else 1/); + assert.match(cliFrontendSource, /runtime-proxy probe retry/); assert.match(clientSource, /res\.status === 404[\s\S]*?RuntimeProbeError/); assert.match(clientSource, /res\.status === 401 \|\| res\.status === 403/); assert.match(clientSource, /error instanceof RuntimeAccessDeniedError \|\|[\s\S]*?error instanceof RuntimeProbeError/); diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index ce57ab2f..ab6c6b8e 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -3206,26 +3206,88 @@ async def _list_region_window(reg: str) -> tuple[list[dict], bool]: # Cache resolved (endpoint, apikey, auth type) per runtime so the data-plane # proxy does not call GetRuntime on every request. Short TTL; cleared on a 401. - _rt_conn_cache: dict[tuple[str, str], tuple[str, str, str, float]] = {} + _rt_conn_cache: dict[tuple[str, str], tuple[str, str, str, str, float]] = {} + + def _runtime_endpoint_host(endpoint: str) -> str: + parsed = urlparse(endpoint or "") + return parsed.hostname or parsed.netloc or "" + + def _runtime_proxy_should_retry_probe(method: str, path: str) -> bool: + if method.upper() != "GET": + return False + normalized = path.strip("/") + if normalized == "list-apps" or normalized.startswith("web/agent-info/"): + return True + parts = normalized.split("/") + return ( + len(parts) == 5 + and parts[0] == "apps" + and parts[2] == "users" + and parts[4] == "sessions" + ) + + def _runtime_proxy_retry_delay(attempt: int) -> float: + return min(5.0, float(2 ** max(0, attempt - 1))) + + def _runtime_network_error_detail( + endpoint_network_type: str, + *, + timeout: bool, + json_request: bool = False, + ) -> str: + if endpoint_network_type == "private": + return "runtime_private_endpoint_unreachable" + if json_request: + return "runtime_json_timeout" if timeout else "runtime_json_connect_error" + return "runtime_proxy_timeout" if timeout else "runtime_proxy_connect_error" + + def _runtime_network_log_items(runtime: Any) -> list[dict[str, Any]]: + items = [] + for index, nc in enumerate( + getattr(runtime, "network_configurations", None) or [] + ): + endpoint = getattr(nc, "endpoint", "") or "" + items.append( + { + "index": index, + "network_type": getattr(nc, "network_type", "") or "", + "endpoint_present": bool(endpoint), + "endpoint_host": _runtime_endpoint_host(endpoint), + } + ) + return items def _resolve_runtime_conn( runtime_id: str, region: str, runtime: Any | None = None, - ) -> tuple[str, str, str]: + ) -> tuple[str, str, str, str]: import time as _time cache_key = (region, runtime_id) cached = _rt_conn_cache.get(cache_key) - if cached and cached[3] > _time.time(): - return cached[0], cached[1], cached[2] + if cached and cached[4] > _time.time(): + logger.info( + "runtime conn cache hit runtime_id=%s region=%s endpoint_host=%s " + "auth_type=%s network_type=%s", + runtime_id, + region, + _runtime_endpoint_host(cached[0]), + cached[2], + cached[3], + ) + return cached[0], cached[1], cached[2], cached[3] r = runtime if runtime is not None else _get_runtime(runtime_id, region) endpoint = "" + endpoint_source = "" + endpoint_network_type = "" for nc in getattr(r, "network_configurations", None) or []: ep = getattr(nc, "endpoint", "") or "" if ep: + endpoint_network_type = getattr(nc, "network_type", "") or "" endpoint = ep - if getattr(nc, "network_type", "") == "public": + endpoint_source = f"network_config:{endpoint_network_type or 'unknown'}" + if endpoint_network_type == "public": break apikey = "" auth = getattr(r, "authorizer_configuration", None) @@ -3237,7 +3299,36 @@ def _resolve_runtime_conn( auth_type = "key_auth" elif custom_jwt_auth: auth_type = "custom_jwt" + top_level_endpoint = getattr(r, "endpoint", "") or "" + logger.info( + "resolved runtime metadata runtime_id=%s region=%s runtime_name=%s " + "status=%s version=%s top_endpoint_present=%s top_endpoint_host=%s " + "network_configs=%s selected_endpoint_source=%s " + "selected_endpoint_host=%s auth_type=%s", + runtime_id, + region, + getattr(r, "name", "") or "", + getattr(r, "status", "") or "", + getattr(r, "current_version_number", "") or "", + bool(top_level_endpoint), + _runtime_endpoint_host(top_level_endpoint), + _runtime_network_log_items(r), + endpoint_source or "none", + _runtime_endpoint_host(endpoint), + auth_type, + ) if not endpoint: + logger.warning( + "runtime has no selected endpoint runtime_id=%s region=%s " + "status=%s top_endpoint_present=%s top_endpoint_host=%s " + "network_configs=%s", + runtime_id, + region, + getattr(r, "status", "") or "", + bool(top_level_endpoint), + _runtime_endpoint_host(top_level_endpoint), + _runtime_network_log_items(r), + ) raise HTTPException( status_code=502, detail="runtime has no public endpoint" ) @@ -3245,9 +3336,10 @@ def _resolve_runtime_conn( endpoint, apikey, auth_type, + endpoint_network_type, _time.time() + 300, ) - return endpoint, apikey, auth_type + return endpoint, apikey, auth_type, endpoint_network_type def _runtime_request_headers( request: Request, @@ -3294,7 +3386,7 @@ async def _runtime_proxy(runtime_id: str, path: str, request: Request): region, coded_access_error=True, ) - endpoint, apikey, auth_type = _resolve_runtime_conn( + endpoint, apikey, auth_type, endpoint_network_type = _resolve_runtime_conn( runtime_id, region, runtime, @@ -3308,6 +3400,18 @@ async def _runtime_proxy(runtime_id: str, path: str, request: Request): # Drop the SSO gateway querystring; keep any real API query params. qs = {k: v for k, v in request.query_params.items() if k != "region"} target = f"{endpoint.rstrip('/')}/{path}" + target_host = _runtime_endpoint_host(target) + logger.info( + "runtime-proxy upstream request runtime_id=%s region=%s method=%s " + "path=%s target_host=%s query_keys=%s auth_type=%s", + runtime_id, + region, + request.method, + path, + target_host, + sorted(qs.keys()), + auth_type, + ) # Use the shared proxy header builder so Origin/Referer and other # browser-only headers are stripped (the ADK server rejects them with # "origin not allowed" / 403 otherwise). @@ -3341,14 +3445,110 @@ async def _runtime_proxy(runtime_id: str, path: str, request: Request): from fastapi.responses import StreamingResponse + retry_probe = _runtime_proxy_should_retry_probe(request.method, path) + max_attempts = 10 if retry_probe else 1 + timeout = httpx.Timeout(10.0, connect=5.0) if retry_probe else None + # Open the upstream stream so we can forward status + body incrementally. - client = httpx.AsyncClient(timeout=None) - req = client.build_request( - request.method, target, params=qs, headers=headers, content=body - ) - upstream = await client.send(req, stream=True) + client = httpx.AsyncClient(timeout=timeout) + upstream = None + for attempt in range(1, max_attempts + 1): + req = client.build_request( + request.method, target, params=qs, headers=headers, content=body + ) + try: + upstream = await client.send(req, stream=True) + if attempt > 1: + logger.info( + "runtime-proxy probe succeeded after retry " + "runtime_id=%s region=%s path=%s target_host=%s " + "attempt=%s max_attempts=%s", + runtime_id, + region, + path, + target_host, + attempt, + max_attempts, + ) + break + except (httpx.ConnectError, httpx.TimeoutException) as error: + timed_out = isinstance(error, httpx.TimeoutException) + if attempt < max_attempts: + delay = _runtime_proxy_retry_delay(attempt) + logger.warning( + "runtime-proxy probe retry runtime_id=%s region=%s " + "method=%s path=%s target_host=%s network_type=%s " + "attempt=%s max_attempts=%s delay=%.1fs error=%s", + runtime_id, + region, + request.method, + path, + target_host, + endpoint_network_type, + attempt, + max_attempts, + delay, + error, + ) + await asyncio.sleep(delay) + continue + await client.aclose() + logger.error( + "runtime-proxy %s runtime_id=%s region=%s method=%s " + "path=%s target_host=%s query_keys=%s network_type=%s " + "attempt=%s max_attempts=%s error=%s", + "timeout" if timed_out else "connect failed", + runtime_id, + region, + request.method, + path, + target_host, + sorted(qs.keys()), + endpoint_network_type, + attempt, + max_attempts, + error, + exc_info=True, + ) + raise HTTPException( + status_code=504 if timed_out else 502, + detail=_runtime_network_error_detail( + endpoint_network_type, + timeout=timed_out, + ), + ) from error + except httpx.HTTPError as error: + await client.aclose() + logger.error( + "runtime-proxy request failed runtime_id=%s region=%s " + "method=%s path=%s target_host=%s query_keys=%s error=%s", + runtime_id, + region, + request.method, + path, + target_host, + sorted(qs.keys()), + error, + exc_info=True, + ) + raise HTTPException( + status_code=502, detail="runtime_proxy_request_error" + ) from error + if upstream is None: + await client.aclose() + raise HTTPException(status_code=502, detail="runtime_proxy_request_error") if upstream.status_code == 401: _rt_conn_cache.pop((region, runtime_id), None) + logger.info( + "runtime-proxy upstream response runtime_id=%s region=%s method=%s " + "path=%s target_host=%s status=%s", + runtime_id, + region, + request.method, + path, + target_host, + upstream.status_code, + ) if upstream.status_code >= 400: # Buffer error responses so we can log the body and still forward it. body_chunks = [] @@ -3648,7 +3848,7 @@ async def _runtime_json_request( payload: dict[str, Any] | None = None, ) -> dict[str, Any]: """Call one authorized Runtime JSON endpoint from the Studio server.""" - endpoint, apikey, auth_type = _resolve_runtime_conn( + endpoint, apikey, auth_type, endpoint_network_type = _resolve_runtime_conn( runtime_id, region, runtime, @@ -3661,15 +3861,95 @@ async def _runtime_json_request( headers["Accept"] = "application/json" if payload is not None: headers["Content-Type"] = "application/json" + target = f"{endpoint.rstrip('/')}/{path.lstrip('/')}" + target_host = _runtime_endpoint_host(target) + logger.info( + "runtime json request runtime_id=%s region=%s method=%s path=%s " + "target_host=%s payload_present=%s auth_type=%s", + runtime_id, + region, + method, + path, + target_host, + payload is not None, + auth_type, + ) async with httpx.AsyncClient(timeout=30.0) as client: - response = await client.request( - method, - f"{endpoint.rstrip('/')}/{path.lstrip('/')}", - headers=headers, - json=payload, - ) + try: + response = await client.request( + method, + target, + headers=headers, + json=payload, + ) + except httpx.ConnectError as error: + logger.error( + "runtime json connect failed runtime_id=%s region=%s " + "method=%s path=%s target_host=%s error=%s", + runtime_id, + region, + method, + path, + target_host, + error, + exc_info=True, + ) + raise HTTPException( + status_code=502, + detail=_runtime_network_error_detail( + endpoint_network_type, + timeout=False, + json_request=True, + ), + ) from error + except httpx.TimeoutException as error: + logger.error( + "runtime json timeout runtime_id=%s region=%s method=%s " + "path=%s target_host=%s error=%s", + runtime_id, + region, + method, + path, + target_host, + error, + exc_info=True, + ) + raise HTTPException( + status_code=504, + detail=_runtime_network_error_detail( + endpoint_network_type, + timeout=True, + json_request=True, + ), + ) from error + except httpx.HTTPError as error: + logger.error( + "runtime json request failed runtime_id=%s region=%s " + "method=%s path=%s target_host=%s error=%s", + runtime_id, + region, + method, + path, + target_host, + error, + exc_info=True, + ) + raise HTTPException( + status_code=502, detail="runtime_json_request_error" + ) from error if response.status_code >= 400: detail = response.text.strip()[:2000] + logger.warning( + "runtime json upstream error runtime_id=%s region=%s method=%s " + "path=%s target_host=%s status=%s body=%s", + runtime_id, + region, + method, + path, + target_host, + response.status_code, + detail[:500], + ) raise HTTPException( status_code=response.status_code, detail=detail or f"Runtime returned HTTP {response.status_code}", diff --git a/veadk/webui/assets/CodeEditor-DMEaV9T5.js b/veadk/webui/assets/CodeEditor-B-6sJbzV.js similarity index 99% rename from veadk/webui/assets/CodeEditor-DMEaV9T5.js rename to veadk/webui/assets/CodeEditor-B-6sJbzV.js index 645c05de..f0353880 100644 --- a/veadk/webui/assets/CodeEditor-DMEaV9T5.js +++ b/veadk/webui/assets/CodeEditor-B-6sJbzV.js @@ -1,4 +1,4 @@ -import{A as xe,t as sf}from"./index-ReIAjR7J.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:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!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(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%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)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$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'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%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'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(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)[#Jv_al$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%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$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?O$@a_!q7`$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%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%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$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,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{A as xe,t as sf}from"./index-CACIXhe9.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:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!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(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%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)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$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'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%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'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(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)[#Jv_al$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%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$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?O$@a_!q7`$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%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%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$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,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=` `){[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-7jWSKsBd.js b/veadk/webui/assets/MarkdownPromptEditor-DlOTcMR-.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-7jWSKsBd.js rename to veadk/webui/assets/MarkdownPromptEditor-DlOTcMR-.js index 28eff3a2..42cf3ba9 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-7jWSKsBd.js +++ b/veadk/webui/assets/MarkdownPromptEditor-DlOTcMR-.js @@ -1,4 +1,4 @@ -var i2=Object.defineProperty;var s2=(t,e,n)=>e in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as l2,f as a2,g as Fc,y as c2,G as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-ReIAjR7J.js";const C2={}.hasOwnProperty;function am(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as l2,f as a2,g as Fc,y as c2,G as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-CACIXhe9.js";const C2={}.hasOwnProperty;function am(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-DlOTcMR-.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); var LB=Object.defineProperty;var MB=(e,t,n)=>t in e?LB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lk=(e,t,n)=>MB(e,typeof t!="symbol"?t+"":t,n);function jB(e,t){for(var n=0;nr[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var cm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tI={exports:{}},Ng={},nI={exports:{}},Tt={};/** * @license React * react.production.min.js @@ -7,7 +7,7 @@ var LB=Object.defineProperty;var MB=(e,t,n)=>t in e?LB(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ff=Symbol.for("react.element"),DB=Symbol.for("react.portal"),PB=Symbol.for("react.fragment"),BB=Symbol.for("react.strict_mode"),FB=Symbol.for("react.profiler"),UB=Symbol.for("react.provider"),$B=Symbol.for("react.context"),HB=Symbol.for("react.forward_ref"),zB=Symbol.for("react.suspense"),VB=Symbol.for("react.memo"),KB=Symbol.for("react.lazy"),ck=Symbol.iterator;function YB(e){return e===null||typeof e!="object"?null:(e=ck&&e[ck]||e["@@iterator"],typeof e=="function"?e:null)}var rI={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sI=Object.assign,iI={};function ru(e,t,n){this.props=e,this.context=t,this.refs=iI,this.updater=n||rI}ru.prototype.isReactComponent={};ru.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ru.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function aI(){}aI.prototype=ru.prototype;function _x(e,t,n){this.props=e,this.context=t,this.refs=iI,this.updater=n||rI}var kx=_x.prototype=new aI;kx.constructor=_x;sI(kx,ru.prototype);kx.isPureReactComponent=!0;var uk=Array.isArray,oI=Object.prototype.hasOwnProperty,Nx={current:null},lI={key:!0,ref:!0,__self:!0,__source:!0};function cI(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)oI.call(t,r)&&!lI.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1t in e?LB(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var s8=E,hs=r8;function Oe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zb=Object.prototype.hasOwnProperty,i8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fk={},hk={};function a8(e){return Zb.call(hk,e)?!0:Zb.call(fk,e)?!1:i8.test(e)?hk[e]=!0:(fk[e]=!0,!1)}function o8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function l8(e,t,n,r){if(t===null||typeof t>"u"||o8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fr(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var mr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mr[e]=new Fr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];mr[t]=new Fr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){mr[e]=new Fr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mr[e]=new Fr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mr[e]=new Fr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){mr[e]=new Fr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){mr[e]=new Fr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){mr[e]=new Fr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){mr[e]=new Fr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tx=/[\-:]([a-z])/g;function Ax(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){mr[e]=new Fr(e,1,!1,e.toLowerCase(),null,!1,!1)});mr.xlinkHref=new Fr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){mr[e]=new Fr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Cx(e,t,n,r){var s=mr.hasOwnProperty(t)?mr[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zb=Object.prototype.hasOwnProperty,i8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fk={},hk={};function a8(e){return Zb.call(hk,e)?!0:Zb.call(fk,e)?!1:i8.test(e)?hk[e]=!0:(fk[e]=!0,!1)}function o8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function l8(e,t,n,r){if(t===null||typeof t>"u"||o8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fr(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var mr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mr[e]=new Fr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];mr[t]=new Fr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){mr[e]=new Fr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mr[e]=new Fr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mr[e]=new Fr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){mr[e]=new Fr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){mr[e]=new Fr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){mr[e]=new Fr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){mr[e]=new Fr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Tx=/[\-:]([a-z])/g;function Ax(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Tx,Ax);mr[t]=new Fr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){mr[e]=new Fr(e,1,!1,e.toLowerCase(),null,!1,!1)});mr.xlinkHref=new Fr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){mr[e]=new Fr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Cx(e,t,n,r){var s=mr.hasOwnProperty(t)?mr[t]:null;(s!==null?s.type!==0:r||!(2o||s[a]!==i[o]){var c=` -`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{ny=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ed(e):""}function c8(e){switch(e.tag){case 5:return ed(e.type);case 16:return ed("Lazy");case 13:return ed("Suspense");case 19:return ed("SuspenseList");case 0:case 2:case 15:return e=ry(e.type,!1),e;case 11:return e=ry(e.type.render,!1),e;case 1:return e=ry(e.type,!0),e;default:return""}}function n1(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ul:return"Fragment";case Fl:return"Portal";case Jb:return"Profiler";case Ix:return"StrictMode";case e1:return"Suspense";case t1:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yI:return(e.displayName||"Context")+".Consumer";case gI:return(e._context.displayName||"Context")+".Provider";case Rx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ox:return t=e.displayName||null,t!==null?t:n1(e.type)||"Memo";case Ma:t=e._payload,e=e._init;try{return n1(e(t))}catch{}}return null}function u8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return n1(t);case 8:return t===Ix?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function no(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function EI(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function d8(e){var t=EI(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lh(e){e._valueTracker||(e._valueTracker=d8(e))}function xI(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=EI(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function um(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function r1(e,t){var n=t.checked;return An({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=no(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wI(e,t){t=t.checked,t!=null&&Cx(e,"checked",t,!1)}function s1(e,t){wI(e,t);var n=no(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?i1(e,t.type,n):t.hasOwnProperty("defaultValue")&&i1(e,t.type,no(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function i1(e,t,n){(t!=="number"||um(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var td=Array.isArray;function uc(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Mh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var gd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},f8=["Webkit","ms","Moz","O"];Object.keys(gd).forEach(function(e){f8.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),gd[t]=gd[e]})});function NI(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||gd.hasOwnProperty(e)&&gd[e]?(""+t).trim():t+"px"}function SI(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=NI(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var h8=An({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function l1(e,t){if(t){if(h8[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Oe(62))}}function c1(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var u1=null;function Lx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var d1=null,dc=null,fc=null;function Ek(e){if(e=Hf(e)){if(typeof d1!="function")throw Error(Oe(280));var t=e.stateNode;t&&(t=Ig(t),d1(e.stateNode,e.type,t))}}function TI(e){dc?fc?fc.push(e):fc=[e]:dc=e}function AI(){if(dc){var e=dc,t=fc;if(fc=dc=null,Ek(e),t)for(e=0;e>>=0,e===0?32:31-(k8(e)/N8|0)|0}var jh=64,Dh=4194304;function nd(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=nd(o):(i&=a,i!==0&&(r=nd(i)))}else a=n&~s,a!==0?r=nd(a):i!==0&&(r=nd(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Uf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-oi(t),e[t]=n}function C8(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=bd),Ak=" ",Ck=!1;function WI(e,t){switch(e){case"keyup":return rF.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $l=!1;function iF(e,t){switch(e){case"compositionend":return qI(t);case"keypress":return t.which!==32?null:(Ck=!0,Ak);case"textInput":return e=t.data,e===Ak&&Ck?null:e;default:return null}}function aF(e,t){if($l)return e==="compositionend"||!$x&&WI(e,t)?(e=YI(),Lp=Bx=$a=null,$l=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Lk(n)}}function JI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?JI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function eR(){for(var e=window,t=um();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=um(e.document)}return t}function Hx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function mF(e){var t=eR(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&JI(n.ownerDocument.documentElement,n)){if(r!==null&&Hx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Mk(n,i);var a=Mk(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hl=null,y1=null,xd=null,b1=!1;function jk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;b1||Hl==null||Hl!==um(r)||(r=Hl,"selectionStart"in r&&Hx(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xd&&Jd(xd,r)||(xd=r,r=ym(y1,"onSelect"),0Kl||(e.current=k1[Kl],k1[Kl]=null,Kl--)}function nn(e,t){Kl++,k1[Kl]=e.current,e.current=t}var ro={},Nr=oo(ro),Wr=oo(!1),Xo=ro;function Tc(e,t){var n=e.type.contextTypes;if(!n)return ro;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function qr(e){return e=e.childContextTypes,e!=null}function Em(){ln(Wr),ln(Nr)}function Hk(e,t,n){if(Nr.current!==ro)throw Error(Oe(168));nn(Nr,t),nn(Wr,n)}function cR(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Oe(108,u8(e)||"Unknown",s));return An({},n,r)}function xm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ro,Xo=Nr.current,nn(Nr,e),nn(Wr,Wr.current),!0}function zk(e,t,n){var r=e.stateNode;if(!r)throw Error(Oe(169));n?(e=cR(e,t,Xo),r.__reactInternalMemoizedMergedChildContext=e,ln(Wr),ln(Nr),nn(Nr,e)):ln(Wr),nn(Wr,n)}var Ji=null,Rg=!1,yy=!1;function uR(e){Ji===null?Ji=[e]:Ji.push(e)}function TF(e){Rg=!0,uR(e)}function lo(){if(!yy&&Ji!==null){yy=!0;var e=0,t=Vt;try{var n=Ji;for(Vt=1;e>=a,s-=a,ta=1<<32-oi(t)+s|n<S?(C=A,A=null):C=A.sibling;var R=h(y,A,b[S],_);if(R===null){A===null&&(A=C);break}e&&A&&R.alternate===null&&t(y,A),w=i(R,w,S),N===null?k=R:N.sibling=R,N=R,A=C}if(S===b.length)return n(y,A),yn&&ko(y,S),k;if(A===null){for(;SS?(C=A,A=null):C=A.sibling;var O=h(y,A,R.value,_);if(O===null){A===null&&(A=C);break}e&&A&&O.alternate===null&&t(y,A),w=i(O,w,S),N===null?k=O:N.sibling=O,N=O,A=C}if(R.done)return n(y,A),yn&&ko(y,S),k;if(A===null){for(;!R.done;S++,R=b.next())R=f(y,R.value,_),R!==null&&(w=i(R,w,S),N===null?k=R:N.sibling=R,N=R);return yn&&ko(y,S),k}for(A=r(y,A);!R.done;S++,R=b.next())R=p(A,y,S,R.value,_),R!==null&&(e&&R.alternate!==null&&A.delete(R.key===null?S:R.key),w=i(R,w,S),N===null?k=R:N.sibling=R,N=R);return e&&A.forEach(function(F){return t(y,F)}),yn&&ko(y,S),k}function x(y,w,b,_){if(typeof b=="object"&&b!==null&&b.type===Ul&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Oh:e:{for(var k=b.key,N=w;N!==null;){if(N.key===k){if(k=b.type,k===Ul){if(N.tag===7){n(y,N.sibling),w=s(N,b.props.children),w.return=y,y=w;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ma&&Yk(k)===N.type){n(y,N.sibling),w=s(N,b.props),w.ref=Du(y,N,b),w.return=y,y=w;break e}n(y,N);break}else t(y,N);N=N.sibling}b.type===Ul?(w=zo(b.props.children,y.mode,_,b.key),w.return=y,y=w):(_=$p(b.type,b.key,b.props,null,y.mode,_),_.ref=Du(y,w,b),_.return=y,y=_)}return a(y);case Fl:e:{for(N=b.key;w!==null;){if(w.key===N)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=s(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else t(y,w);w=w.sibling}w=Ny(b,y.mode,_),w.return=y,y=w}return a(y);case Ma:return N=b._init,x(y,w,N(b._payload),_)}if(td(b))return m(y,w,b,_);if(Ru(b))return g(y,w,b,_);zh(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=s(w,b),w.return=y,y=w):(n(y,w),w=ky(b,y.mode,_),w.return=y,y=w),a(y)):n(y,w)}return x}var Cc=pR(!0),mR=pR(!1),_m=oo(null),km=null,Wl=null,Yx=null;function Gx(){Yx=Wl=km=null}function Wx(e){var t=_m.current;ln(_m),e._currentValue=t}function T1(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pc(e,t){km=e,Yx=Wl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yr=!0),e.firstContext=null)}function Bs(e){var t=e._currentValue;if(Yx!==e)if(e={context:e,memoizedValue:t,next:null},Wl===null){if(km===null)throw Error(Oe(308));Wl=e,km.dependencies={lanes:0,firstContext:e}}else Wl=Wl.next=e;return t}var jo=null;function qx(e){jo===null?jo=[e]:jo.push(e)}function gR(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,qx(t)):(n.next=s.next,s.next=n),t.interleaved=n,da(e,r)}function da(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ja=!1;function Xx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yR(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ia(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,da(e,n)}return s=r.interleaved,s===null?(t.next=t,qx(r)):(t.next=s.next,s.next=t),r.interleaved=t,da(e,n)}function jp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jx(e,n)}}function Gk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Nm(e,t,n,r){var s=e.updateQueue;ja=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,d=u=c=null,o=i;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,g=o;switch(h=t,p=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=An({},f,h);break e;case 2:ja=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Jo|=a,e.lanes=a,e.memoizedState=f}}function Wk(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ey.transition;Ey.transition={};try{e(!1),t()}finally{Vt=n,Ey.transition=r}}function MR(){return Fs().memoizedState}function RF(e,t,n){var r=Qa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},jR(e))DR(t,n);else if(n=gR(e,t,n,r),n!==null){var s=Dr();li(n,e,r,s),PR(n,t,r)}}function OF(e,t,n){var r=Qa(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(jR(e))DR(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,fi(o,a)){var c=t.interleaved;c===null?(s.next=s,qx(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=gR(e,t,s,r),n!==null&&(s=Dr(),li(n,e,r,s),PR(n,t,r))}}function jR(e){var t=e.alternate;return e===Tn||t!==null&&t===Tn}function DR(e,t){wd=Tm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function PR(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jx(e,n)}}var Am={readContext:Bs,useCallback:br,useContext:br,useEffect:br,useImperativeHandle:br,useInsertionEffect:br,useLayoutEffect:br,useMemo:br,useReducer:br,useRef:br,useState:br,useDebugValue:br,useDeferredValue:br,useTransition:br,useMutableSource:br,useSyncExternalStore:br,useId:br,unstable_isNewReconciler:!1},LF={readContext:Bs,useCallback:function(e,t){return Ni().memoizedState=[e,t===void 0?null:t],e},useContext:Bs,useEffect:Xk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pp(4194308,4,CR.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pp(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pp(4,2,e,t)},useMemo:function(e,t){var n=Ni();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ni();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=RF.bind(null,Tn,e),[r.memoizedState,e]},useRef:function(e){var t=Ni();return e={current:e},t.memoizedState=e},useState:qk,useDebugValue:sw,useDeferredValue:function(e){return Ni().memoizedState=e},useTransition:function(){var e=qk(!1),t=e[0];return e=IF.bind(null,e[1]),Ni().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Tn,s=Ni();if(yn){if(n===void 0)throw Error(Oe(407));n=n()}else{if(n=t(),ar===null)throw Error(Oe(349));Zo&30||wR(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Xk(_R.bind(null,r,i,e),[e]),r.flags|=2048,lf(9,vR.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ni(),t=ar.identifierPrefix;if(yn){var n=na,r=ta;n=(r&~(1<<32-oi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=af++,0")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{ny=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?td(e):""}function c8(e){switch(e.tag){case 5:return td(e.type);case 16:return td("Lazy");case 13:return td("Suspense");case 19:return td("SuspenseList");case 0:case 2:case 15:return e=ry(e.type,!1),e;case 11:return e=ry(e.type.render,!1),e;case 1:return e=ry(e.type,!0),e;default:return""}}function n1(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ul:return"Fragment";case Fl:return"Portal";case Jb:return"Profiler";case Ix:return"StrictMode";case e1:return"Suspense";case t1:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case yI:return(e.displayName||"Context")+".Consumer";case gI:return(e._context.displayName||"Context")+".Provider";case Rx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ox:return t=e.displayName||null,t!==null?t:n1(e.type)||"Memo";case Ma:t=e._payload,e=e._init;try{return n1(e(t))}catch{}}return null}function u8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return n1(t);case 8:return t===Ix?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function no(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function EI(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function d8(e){var t=EI(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lh(e){e._valueTracker||(e._valueTracker=d8(e))}function xI(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=EI(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function um(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function r1(e,t){var n=t.checked;return An({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mk(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=no(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wI(e,t){t=t.checked,t!=null&&Cx(e,"checked",t,!1)}function s1(e,t){wI(e,t);var n=no(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?i1(e,t.type,n):t.hasOwnProperty("defaultValue")&&i1(e,t.type,no(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function gk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function i1(e,t,n){(t!=="number"||um(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nd=Array.isArray;function uc(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Mh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Wd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yd={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},f8=["Webkit","ms","Moz","O"];Object.keys(yd).forEach(function(e){f8.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yd[t]=yd[e]})});function NI(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yd.hasOwnProperty(e)&&yd[e]?(""+t).trim():t+"px"}function SI(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=NI(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var h8=An({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function l1(e,t){if(t){if(h8[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Oe(62))}}function c1(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var u1=null;function Lx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var d1=null,dc=null,fc=null;function Ek(e){if(e=Hf(e)){if(typeof d1!="function")throw Error(Oe(280));var t=e.stateNode;t&&(t=Ig(t),d1(e.stateNode,e.type,t))}}function TI(e){dc?fc?fc.push(e):fc=[e]:dc=e}function AI(){if(dc){var e=dc,t=fc;if(fc=dc=null,Ek(e),t)for(e=0;e>>=0,e===0?32:31-(k8(e)/N8|0)|0}var jh=64,Dh=4194304;function rd(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=rd(o):(i&=a,i!==0&&(r=rd(i)))}else a=n&~s,a!==0?r=rd(a):i!==0&&(r=rd(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Uf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-oi(t),e[t]=n}function C8(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Ed),Ak=" ",Ck=!1;function WI(e,t){switch(e){case"keyup":return rF.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $l=!1;function iF(e,t){switch(e){case"compositionend":return qI(t);case"keypress":return t.which!==32?null:(Ck=!0,Ak);case"textInput":return e=t.data,e===Ak&&Ck?null:e;default:return null}}function aF(e,t){if($l)return e==="compositionend"||!$x&&WI(e,t)?(e=YI(),Lp=Bx=$a=null,$l=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Lk(n)}}function JI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?JI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function eR(){for(var e=window,t=um();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=um(e.document)}return t}function Hx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function mF(e){var t=eR(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&JI(n.ownerDocument.documentElement,n)){if(r!==null&&Hx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=Mk(n,i);var a=Mk(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Hl=null,y1=null,wd=null,b1=!1;function jk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;b1||Hl==null||Hl!==um(r)||(r=Hl,"selectionStart"in r&&Hx(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),wd&&ef(wd,r)||(wd=r,r=ym(y1,"onSelect"),0Kl||(e.current=k1[Kl],k1[Kl]=null,Kl--)}function nn(e,t){Kl++,k1[Kl]=e.current,e.current=t}var ro={},Nr=oo(ro),Wr=oo(!1),Xo=ro;function Ac(e,t){var n=e.type.contextTypes;if(!n)return ro;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function qr(e){return e=e.childContextTypes,e!=null}function Em(){ln(Wr),ln(Nr)}function Hk(e,t,n){if(Nr.current!==ro)throw Error(Oe(168));nn(Nr,t),nn(Wr,n)}function cR(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Oe(108,u8(e)||"Unknown",s));return An({},n,r)}function xm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ro,Xo=Nr.current,nn(Nr,e),nn(Wr,Wr.current),!0}function zk(e,t,n){var r=e.stateNode;if(!r)throw Error(Oe(169));n?(e=cR(e,t,Xo),r.__reactInternalMemoizedMergedChildContext=e,ln(Wr),ln(Nr),nn(Nr,e)):ln(Wr),nn(Wr,n)}var Ji=null,Rg=!1,yy=!1;function uR(e){Ji===null?Ji=[e]:Ji.push(e)}function TF(e){Rg=!0,uR(e)}function lo(){if(!yy&&Ji!==null){yy=!0;var e=0,t=Vt;try{var n=Ji;for(Vt=1;e>=a,s-=a,ta=1<<32-oi(t)+s|n<S?(C=A,A=null):C=A.sibling;var R=h(y,A,b[S],_);if(R===null){A===null&&(A=C);break}e&&A&&R.alternate===null&&t(y,A),w=i(R,w,S),N===null?k=R:N.sibling=R,N=R,A=C}if(S===b.length)return n(y,A),yn&&ko(y,S),k;if(A===null){for(;SS?(C=A,A=null):C=A.sibling;var O=h(y,A,R.value,_);if(O===null){A===null&&(A=C);break}e&&A&&O.alternate===null&&t(y,A),w=i(O,w,S),N===null?k=O:N.sibling=O,N=O,A=C}if(R.done)return n(y,A),yn&&ko(y,S),k;if(A===null){for(;!R.done;S++,R=b.next())R=f(y,R.value,_),R!==null&&(w=i(R,w,S),N===null?k=R:N.sibling=R,N=R);return yn&&ko(y,S),k}for(A=r(y,A);!R.done;S++,R=b.next())R=p(A,y,S,R.value,_),R!==null&&(e&&R.alternate!==null&&A.delete(R.key===null?S:R.key),w=i(R,w,S),N===null?k=R:N.sibling=R,N=R);return e&&A.forEach(function(F){return t(y,F)}),yn&&ko(y,S),k}function x(y,w,b,_){if(typeof b=="object"&&b!==null&&b.type===Ul&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Oh:e:{for(var k=b.key,N=w;N!==null;){if(N.key===k){if(k=b.type,k===Ul){if(N.tag===7){n(y,N.sibling),w=s(N,b.props.children),w.return=y,y=w;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ma&&Yk(k)===N.type){n(y,N.sibling),w=s(N,b.props),w.ref=Pu(y,N,b),w.return=y,y=w;break e}n(y,N);break}else t(y,N);N=N.sibling}b.type===Ul?(w=zo(b.props.children,y.mode,_,b.key),w.return=y,y=w):(_=$p(b.type,b.key,b.props,null,y.mode,_),_.ref=Pu(y,w,b),_.return=y,y=_)}return a(y);case Fl:e:{for(N=b.key;w!==null;){if(w.key===N)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){n(y,w.sibling),w=s(w,b.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else t(y,w);w=w.sibling}w=Ny(b,y.mode,_),w.return=y,y=w}return a(y);case Ma:return N=b._init,x(y,w,N(b._payload),_)}if(nd(b))return m(y,w,b,_);if(Ou(b))return g(y,w,b,_);zh(y,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(n(y,w.sibling),w=s(w,b),w.return=y,y=w):(n(y,w),w=ky(b,y.mode,_),w.return=y,y=w),a(y)):n(y,w)}return x}var Ic=pR(!0),mR=pR(!1),_m=oo(null),km=null,Wl=null,Yx=null;function Gx(){Yx=Wl=km=null}function Wx(e){var t=_m.current;ln(_m),e._currentValue=t}function T1(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pc(e,t){km=e,Yx=Wl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yr=!0),e.firstContext=null)}function Bs(e){var t=e._currentValue;if(Yx!==e)if(e={context:e,memoizedValue:t,next:null},Wl===null){if(km===null)throw Error(Oe(308));Wl=e,km.dependencies={lanes:0,firstContext:e}}else Wl=Wl.next=e;return t}var jo=null;function qx(e){jo===null?jo=[e]:jo.push(e)}function gR(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,qx(t)):(n.next=s.next,s.next=n),t.interleaved=n,da(e,r)}function da(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ja=!1;function Xx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yR(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ia(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,da(e,n)}return s=r.interleaved,s===null?(t.next=t,qx(r)):(t.next=s.next,s.next=t),r.interleaved=t,da(e,n)}function jp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jx(e,n)}}function Gk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Nm(e,t,n,r){var s=e.updateQueue;ja=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,d=u=c=null,o=i;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,g=o;switch(h=t,p=n,g.tag){case 1:if(m=g.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=An({},f,h);break e;case 2:ja=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Jo|=a,e.lanes=a,e.memoizedState=f}}function Wk(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Ey.transition;Ey.transition={};try{e(!1),t()}finally{Vt=n,Ey.transition=r}}function MR(){return Fs().memoizedState}function RF(e,t,n){var r=Qa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},jR(e))DR(t,n);else if(n=gR(e,t,n,r),n!==null){var s=Dr();li(n,e,r,s),PR(n,t,r)}}function OF(e,t,n){var r=Qa(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(jR(e))DR(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,fi(o,a)){var c=t.interleaved;c===null?(s.next=s,qx(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=gR(e,t,s,r),n!==null&&(s=Dr(),li(n,e,r,s),PR(n,t,r))}}function jR(e){var t=e.alternate;return e===Tn||t!==null&&t===Tn}function DR(e,t){vd=Tm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function PR(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jx(e,n)}}var Am={readContext:Bs,useCallback:br,useContext:br,useEffect:br,useImperativeHandle:br,useInsertionEffect:br,useLayoutEffect:br,useMemo:br,useReducer:br,useRef:br,useState:br,useDebugValue:br,useDeferredValue:br,useTransition:br,useMutableSource:br,useSyncExternalStore:br,useId:br,unstable_isNewReconciler:!1},LF={readContext:Bs,useCallback:function(e,t){return Ni().memoizedState=[e,t===void 0?null:t],e},useContext:Bs,useEffect:Xk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pp(4194308,4,CR.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pp(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pp(4,2,e,t)},useMemo:function(e,t){var n=Ni();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ni();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=RF.bind(null,Tn,e),[r.memoizedState,e]},useRef:function(e){var t=Ni();return e={current:e},t.memoizedState=e},useState:qk,useDebugValue:sw,useDeferredValue:function(e){return Ni().memoizedState=e},useTransition:function(){var e=qk(!1),t=e[0];return e=IF.bind(null,e[1]),Ni().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Tn,s=Ni();if(yn){if(n===void 0)throw Error(Oe(407));n=n()}else{if(n=t(),ar===null)throw Error(Oe(349));Zo&30||wR(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Xk(_R.bind(null,r,i,e),[e]),r.flags|=2048,cf(9,vR.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ni(),t=ar.identifierPrefix;if(yn){var n=na,r=ta;n=(r&~(1<<32-oi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=of++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ci]=t,e[nf]=r,GR(e,t,!1,!1),t.stateNode=e;e:{switch(a=c1(n,r),n){case"dialog":on("cancel",e),on("close",e),s=r;break;case"iframe":case"object":case"embed":on("load",e),s=r;break;case"video":case"audio":for(s=0;sOc&&(t.flags|=128,r=!0,Pu(i,!1),t.lanes=4194304)}else{if(!r)if(e=Sm(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!yn)return Er(t),null}else 2*Dn()-i.renderingStartTime>Oc&&n!==1073741824&&(t.flags|=128,r=!0,Pu(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Dn(),t.sibling=null,n=Nn.current,nn(Nn,r?n&1|2:n&1),t):(Er(t),null);case 22:case 23:return uw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?as&1073741824&&(Er(t),t.subtreeFlags&6&&(t.flags|=8192)):Er(t),null;case 24:return null;case 25:return null}throw Error(Oe(156,t.tag))}function $F(e,t){switch(Vx(t),t.tag){case 1:return qr(t.type)&&Em(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ic(),ln(Wr),ln(Nr),Jx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zx(t),null;case 13:if(ln(Nn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Oe(340));Ac()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ln(Nn),null;case 4:return Ic(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return uw(),null;case 24:return null;default:return null}}var Kh=!1,wr=!1,HF=typeof WeakSet=="function"?WeakSet:Set,ze=null;function ql(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){On(e,t,r)}else n.current=null}function D1(e,t,n){try{n()}catch(r){On(e,t,r)}}var oN=!1;function zF(e,t){if(E1=mm,e=eR(),Hx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(o=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(o=a),h===i&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(x1={focusedElem:e,selectionRange:n},mm=!1,ze=t;ze!==null;)if(t=ze,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ze=e;else for(;ze!==null;){t=ze;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,x=m.memoizedState,y=t.stateNode,w=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:Zs(t.type,g),x);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(_){On(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,ze=e;break}ze=t.return}return m=oN,oN=!1,m}function vd(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&D1(t,n,i)}s=s.next}while(s!==r)}}function Mg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function P1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function XR(e){var t=e.alternate;t!==null&&(e.alternate=null,XR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ci],delete t[nf],delete t[_1],delete t[NF],delete t[SF])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function QR(e){return e.tag===5||e.tag===3||e.tag===4}function lN(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||QR(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function B1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bm));else if(r!==4&&(e=e.child,e!==null))for(B1(e,t,n),e=e.sibling;e!==null;)B1(e,t,n),e=e.sibling}function F1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(F1(e,t,n),e=e.sibling;e!==null;)F1(e,t,n),e=e.sibling}var fr=null,Js=!1;function Sa(e,t,n){for(n=n.child;n!==null;)ZR(e,t,n),n=n.sibling}function ZR(e,t,n){if(Ri&&typeof Ri.onCommitFiberUnmount=="function")try{Ri.onCommitFiberUnmount(Sg,n)}catch{}switch(n.tag){case 5:wr||ql(n,t);case 6:var r=fr,s=Js;fr=null,Sa(e,t,n),fr=r,Js=s,fr!==null&&(Js?(e=fr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):fr.removeChild(n.stateNode));break;case 18:fr!==null&&(Js?(e=fr,n=n.stateNode,e.nodeType===8?gy(e.parentNode,n):e.nodeType===1&&gy(e,n),Qd(e)):gy(fr,n.stateNode));break;case 4:r=fr,s=Js,fr=n.stateNode.containerInfo,Js=!0,Sa(e,t,n),fr=r,Js=s;break;case 0:case 11:case 14:case 15:if(!wr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&D1(n,t,a),s=s.next}while(s!==r)}Sa(e,t,n);break;case 1:if(!wr&&(ql(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){On(n,t,o)}Sa(e,t,n);break;case 21:Sa(e,t,n);break;case 22:n.mode&1?(wr=(r=wr)||n.memoizedState!==null,Sa(e,t,n),wr=r):Sa(e,t,n);break;default:Sa(e,t,n)}}function cN(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new HF),t.forEach(function(r){var s=ZF.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ws(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~i}if(r=s,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*KF(r/1960))-r,10e?16:e,Ha===null)var r=!1;else{if(e=Ha,Ha=null,Rm=0,Pt&6)throw Error(Oe(331));var s=Pt;for(Pt|=4,ze=e.current;ze!==null;){var i=ze,a=i.child;if(ze.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cDn()-lw?Ho(e,0):ow|=n),Xr(e,t)}function aO(e,t){t===0&&(e.mode&1?(t=Dh,Dh<<=1,!(Dh&130023424)&&(Dh=4194304)):t=1);var n=Dr();e=da(e,t),e!==null&&(Uf(e,t,n),Xr(e,n))}function QF(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aO(e,n)}function ZF(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Oe(314))}r!==null&&r.delete(t),aO(e,n)}var oO;oO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wr.current)Yr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yr=!1,FF(e,t,n);Yr=!!(e.flags&131072)}else Yr=!1,yn&&t.flags&1048576&&dR(t,vm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bp(e,t),e=t.pendingProps;var s=Tc(t,Nr.current);pc(t,n),s=tw(null,t,r,e,s,n);var i=nw();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qr(r)?(i=!0,xm(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Xx(t),s.updater=Lg,t.stateNode=s,s._reactInternals=t,C1(t,r,e,n),t=O1(null,t,r,!0,i,n)):(t.tag=0,yn&&i&&zx(t),Or(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=e9(r),e=Zs(r,e),s){case 0:t=R1(null,t,r,e,n);break e;case 1:t=sN(null,t,r,e,n);break e;case 11:t=nN(null,t,r,e,n);break e;case 14:t=rN(null,t,r,Zs(r.type,e),n);break e}throw Error(Oe(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),R1(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),sN(e,t,r,s,n);case 3:e:{if(VR(t),e===null)throw Error(Oe(387));r=t.pendingProps,i=t.memoizedState,s=i.element,yR(e,t),Nm(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Rc(Error(Oe(423)),t),t=iN(e,t,r,n,s);break e}else if(r!==s){s=Rc(Error(Oe(424)),t),t=iN(e,t,r,n,s);break e}else for(cs=Wa(t.stateNode.containerInfo.firstChild),us=t,yn=!0,ti=null,n=mR(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ac(),r===s){t=fa(e,t,n);break e}Or(e,t,r,n)}t=t.child}return t;case 5:return bR(t),e===null&&S1(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,w1(r,s)?a=null:i!==null&&w1(r,i)&&(t.flags|=32),zR(e,t),Or(e,t,a,n),t.child;case 6:return e===null&&S1(t),null;case 13:return KR(e,t,n);case 4:return Qx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Cc(t,null,r,n):Or(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),nN(e,t,r,s,n);case 7:return Or(e,t,t.pendingProps,n),t.child;case 8:return Or(e,t,t.pendingProps.children,n),t.child;case 12:return Or(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,nn(_m,r._currentValue),r._currentValue=a,i!==null)if(fi(i.value,a)){if(i.children===s.children&&!Wr.current){t=fa(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ia(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),T1(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Oe(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),T1(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Or(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,pc(t,n),s=Bs(s),r=r(s),t.flags|=1,Or(e,t,r,n),t.child;case 14:return r=t.type,s=Zs(r,t.pendingProps),s=Zs(r.type,s),rN(e,t,r,s,n);case 15:return $R(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),Bp(e,t),t.tag=1,qr(r)?(e=!0,xm(t)):e=!1,pc(t,n),BR(t,r,s),C1(t,r,s,n),O1(null,t,r,!0,e,n);case 19:return YR(e,t,n);case 22:return HR(e,t,n)}throw Error(Oe(156,t.tag))};function lO(e,t){return jI(e,t)}function JF(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ls(e,t,n,r){return new JF(e,t,n,r)}function fw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function e9(e){if(typeof e=="function")return fw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Rx)return 11;if(e===Ox)return 14}return 2}function Za(e,t){var n=e.alternate;return n===null?(n=Ls(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $p(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")fw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ul:return zo(n.children,s,i,t);case Ix:a=8,s|=8;break;case Jb:return e=Ls(12,n,t,s|2),e.elementType=Jb,e.lanes=i,e;case e1:return e=Ls(13,n,t,s),e.elementType=e1,e.lanes=i,e;case t1:return e=Ls(19,n,t,s),e.elementType=t1,e.lanes=i,e;case bI:return Dg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gI:a=10;break e;case yI:a=9;break e;case Rx:a=11;break e;case Ox:a=14;break e;case Ma:a=16,r=null;break e}throw Error(Oe(130,e==null?e:typeof e,""))}return t=Ls(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function zo(e,t,n,r){return e=Ls(7,e,r,t),e.lanes=n,e}function Dg(e,t,n,r){return e=Ls(22,e,r,t),e.elementType=bI,e.lanes=n,e.stateNode={isHidden:!1},e}function ky(e,t,n){return e=Ls(6,e,null,t),e.lanes=n,e}function Ny(e,t,n){return t=Ls(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function t9(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=iy(0),this.expirationTimes=iy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=iy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function hw(e,t,n,r,s,i,a,o,c){return e=new t9(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ls(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xx(i),e}function n9(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fO)}catch(e){console.error(e)}}fO(),fI.exports=gs;var Us=fI.exports,yN=Us;Qb.createRoot=yN.createRoot,Qb.hydrateRoot=yN.hydrateRoot;const yw=E.createContext({});function $g(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}const Hg=E.createContext(null),uf=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class o9 extends E.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function l9({children:e,isPresent:t}){const n=E.useId(),r=E.useRef(null),s=E.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=E.useContext(uf);return E.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=s.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+i.stack}return{value:e,source:t,stack:s,digest:null}}function vy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function I1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var DF=typeof WeakMap=="function"?WeakMap:Map;function FR(e,t,n){n=ia(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Im||(Im=!0,U1=r),I1(e,t)},n}function UR(e,t,n){n=ia(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){I1(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){I1(e,t),typeof r!="function"&&(Xa===null?Xa=new Set([this]):Xa.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Jk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new DF;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=XF.bind(null,e,t,n),t.then(e,e))}function eN(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function tN(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ia(-1,1),t.tag=2,qa(n,t,1))),n.lanes|=1),e)}var PF=ga.ReactCurrentOwner,Yr=!1;function Or(e,t,n,r){t.child=e===null?mR(t,null,n,r):Ic(t,e.child,n,r)}function nN(e,t,n,r,s){n=n.render;var i=t.ref;return pc(t,s),r=tw(e,t,n,r,i,s),n=nw(),e!==null&&!Yr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,fa(e,t,s)):(yn&&n&&zx(t),t.flags|=1,Or(e,t,r,s),t.child)}function rN(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!fw(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,$R(e,t,i,r,s)):(e=$p(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:ef,n(a,r)&&e.ref===t.ref)return fa(e,t,s)}return t.flags|=1,e=Za(i,r),e.ref=t.ref,e.return=t,t.child=e}function $R(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(ef(i,r)&&e.ref===t.ref)if(Yr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Yr=!0);else return t.lanes=e.lanes,fa(e,t,s)}return R1(e,t,n,r,s)}function HR(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},nn(Xl,as),as|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,nn(Xl,as),as|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,nn(Xl,as),as|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,nn(Xl,as),as|=r;return Or(e,t,s,n),t.child}function zR(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function R1(e,t,n,r,s){var i=qr(n)?Xo:Nr.current;return i=Ac(t,i),pc(t,s),n=tw(e,t,n,r,i,s),r=nw(),e!==null&&!Yr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,fa(e,t,s)):(yn&&r&&zx(t),t.flags|=1,Or(e,t,n,s),t.child)}function sN(e,t,n,r,s){if(qr(n)){var i=!0;xm(t)}else i=!1;if(pc(t,s),t.stateNode===null)Bp(e,t),BR(t,n,r),C1(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=Bs(u):(u=qr(n)?Xo:Nr.current,u=Ac(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||c!==u)&&Zk(t,a,r,u),ja=!1;var h=t.memoizedState;a.state=h,Nm(t,r,a,s),c=t.memoizedState,o!==r||h!==c||Wr.current||ja?(typeof d=="function"&&(A1(t,n,d,r),c=t.memoizedState),(o=ja||Qk(t,n,o,r,h,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,yR(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:Zs(t.type,o),a.props=u,f=t.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Bs(c):(c=qr(n)?Xo:Nr.current,c=Ac(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==f||h!==c)&&Zk(t,a,r,c),ja=!1,h=t.memoizedState,a.state=h,Nm(t,r,a,s);var m=t.memoizedState;o!==f||h!==m||Wr.current||ja?(typeof p=="function"&&(A1(t,n,p,r),m=t.memoizedState),(u=ja||Qk(t,n,u,r,h,m,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,m,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,m,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),a.props=r,a.state=m,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return O1(e,t,n,r,i,s)}function O1(e,t,n,r,s,i){zR(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&zk(t,n,!1),fa(e,t,i);r=t.stateNode,PF.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Ic(t,e.child,null,i),t.child=Ic(t,null,o,i)):Or(e,t,o,i),t.memoizedState=r.state,s&&zk(t,n,!0),t.child}function VR(e){var t=e.stateNode;t.pendingContext?Hk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hk(e,t.context,!1),Qx(e,t.containerInfo)}function iN(e,t,n,r,s){return Cc(),Kx(s),t.flags|=256,Or(e,t,n,r),t.child}var L1={dehydrated:null,treeContext:null,retryLane:0};function M1(e){return{baseLanes:e,cachePool:null,transitions:null}}function KR(e,t,n){var r=t.pendingProps,s=Nn.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(s&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),nn(Nn,s&1),e===null)return S1(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Dg(a,r,0,null),e=zo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=M1(n),t.memoizedState=L1,e):iw(t,a));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return BF(e,t,a,r,o,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,o=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Za(s,c),r.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=Za(o,i):(i=zo(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?M1(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=L1,r}return i=e.child,e=i.sibling,r=Za(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function iw(e,t){return t=Dg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vh(e,t,n,r){return r!==null&&Kx(r),Ic(t,e.child,null,n),e=iw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function BF(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=vy(Error(Oe(422))),Vh(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Dg({mode:"visible",children:r.children},s,0,null),i=zo(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ic(t,e.child,null,a),t.child.memoizedState=M1(a),t.memoizedState=L1,i);if(!(t.mode&1))return Vh(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(Oe(419)),r=vy(i,r,void 0),Vh(e,t,a,r)}if(o=(a&e.childLanes)!==0,Yr||o){if(r=ar,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,da(e,s),li(r,e,s,-1))}return dw(),r=vy(Error(Oe(421))),Vh(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=QF.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,cs=Wa(s.nextSibling),us=t,yn=!0,ti=null,e!==null&&(Ts[As++]=ta,Ts[As++]=na,Ts[As++]=Qo,ta=e.id,na=e.overflow,Qo=t),t=iw(t,r.children),t.flags|=4096,t)}function aN(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),T1(e.return,t,n)}function _y(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function YR(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Or(e,t,r.children,n),r=Nn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&aN(e,n,t);else if(e.tag===19)aN(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(nn(Nn,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&Sm(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),_y(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Sm(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}_y(t,!0,n,null,i);break;case"together":_y(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function fa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Oe(153));if(t.child!==null){for(e=t.child,n=Za(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Za(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function FF(e,t,n){switch(t.tag){case 3:VR(t),Cc();break;case 5:bR(t);break;case 1:qr(t.type)&&xm(t);break;case 4:Qx(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;nn(_m,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(nn(Nn,Nn.current&1),t.flags|=128,null):n&t.child.childLanes?KR(e,t,n):(nn(Nn,Nn.current&1),e=fa(e,t,n),e!==null?e.sibling:null);nn(Nn,Nn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return YR(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),nn(Nn,Nn.current),r)break;return null;case 22:case 23:return t.lanes=0,HR(e,t,n)}return fa(e,t,n)}var GR,j1,WR,qR;GR=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};j1=function(){};WR=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Do(Oi.current);var i=null;switch(n){case"input":s=r1(e,s),r=r1(e,r),i=[];break;case"select":s=An({},s,{value:void 0}),r=An({},r,{value:void 0}),i=[];break;case"textarea":s=a1(e,s),r=a1(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=bm)}l1(n,r);var a;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var o=s[u];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Gd.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(o=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&o[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Gd.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&on("scroll",e),i||o===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};qR=function(e,t,n,r){n!==r&&(t.flags|=4)};function Bu(e,t){if(!yn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Er(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function UF(e,t,n){var r=t.pendingProps;switch(Vx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Er(t),null;case 1:return qr(t.type)&&Em(),Er(t),null;case 3:return r=t.stateNode,Rc(),ln(Wr),ln(Nr),Jx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Hh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ti!==null&&(z1(ti),ti=null))),j1(e,t),Er(t),null;case 5:Zx(t);var s=Do(af.current);if(n=t.type,e!==null&&t.stateNode!=null)WR(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Oe(166));return Er(t),null}if(e=Do(Oi.current),Hh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ci]=t,r[rf]=i,e=(t.mode&1)!==0,n){case"dialog":on("cancel",r),on("close",r);break;case"iframe":case"object":case"embed":on("load",r);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ci]=t,e[rf]=r,GR(e,t,!1,!1),t.stateNode=e;e:{switch(a=c1(n,r),n){case"dialog":on("cancel",e),on("close",e),s=r;break;case"iframe":case"object":case"embed":on("load",e),s=r;break;case"video":case"audio":for(s=0;sLc&&(t.flags|=128,r=!0,Bu(i,!1),t.lanes=4194304)}else{if(!r)if(e=Sm(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!yn)return Er(t),null}else 2*Dn()-i.renderingStartTime>Lc&&n!==1073741824&&(t.flags|=128,r=!0,Bu(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Dn(),t.sibling=null,n=Nn.current,nn(Nn,r?n&1|2:n&1),t):(Er(t),null);case 22:case 23:return uw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?as&1073741824&&(Er(t),t.subtreeFlags&6&&(t.flags|=8192)):Er(t),null;case 24:return null;case 25:return null}throw Error(Oe(156,t.tag))}function $F(e,t){switch(Vx(t),t.tag){case 1:return qr(t.type)&&Em(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Rc(),ln(Wr),ln(Nr),Jx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zx(t),null;case 13:if(ln(Nn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Oe(340));Cc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ln(Nn),null;case 4:return Rc(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return uw(),null;case 24:return null;default:return null}}var Kh=!1,wr=!1,HF=typeof WeakSet=="function"?WeakSet:Set,ze=null;function ql(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){On(e,t,r)}else n.current=null}function D1(e,t,n){try{n()}catch(r){On(e,t,r)}}var oN=!1;function zF(e,t){if(E1=mm,e=eR(),Hx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(o=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(o=a),h===i&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(x1={focusedElem:e,selectionRange:n},mm=!1,ze=t;ze!==null;)if(t=ze,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ze=e;else for(;ze!==null;){t=ze;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var g=m.memoizedProps,x=m.memoizedState,y=t.stateNode,w=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:Zs(t.type,g),x);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Oe(163))}}catch(_){On(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,ze=e;break}ze=t.return}return m=oN,oN=!1,m}function _d(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&D1(t,n,i)}s=s.next}while(s!==r)}}function Mg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function P1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function XR(e){var t=e.alternate;t!==null&&(e.alternate=null,XR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ci],delete t[rf],delete t[_1],delete t[NF],delete t[SF])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function QR(e){return e.tag===5||e.tag===3||e.tag===4}function lN(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||QR(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function B1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bm));else if(r!==4&&(e=e.child,e!==null))for(B1(e,t,n),e=e.sibling;e!==null;)B1(e,t,n),e=e.sibling}function F1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(F1(e,t,n),e=e.sibling;e!==null;)F1(e,t,n),e=e.sibling}var fr=null,Js=!1;function Sa(e,t,n){for(n=n.child;n!==null;)ZR(e,t,n),n=n.sibling}function ZR(e,t,n){if(Ri&&typeof Ri.onCommitFiberUnmount=="function")try{Ri.onCommitFiberUnmount(Sg,n)}catch{}switch(n.tag){case 5:wr||ql(n,t);case 6:var r=fr,s=Js;fr=null,Sa(e,t,n),fr=r,Js=s,fr!==null&&(Js?(e=fr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):fr.removeChild(n.stateNode));break;case 18:fr!==null&&(Js?(e=fr,n=n.stateNode,e.nodeType===8?gy(e.parentNode,n):e.nodeType===1&&gy(e,n),Zd(e)):gy(fr,n.stateNode));break;case 4:r=fr,s=Js,fr=n.stateNode.containerInfo,Js=!0,Sa(e,t,n),fr=r,Js=s;break;case 0:case 11:case 14:case 15:if(!wr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&D1(n,t,a),s=s.next}while(s!==r)}Sa(e,t,n);break;case 1:if(!wr&&(ql(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){On(n,t,o)}Sa(e,t,n);break;case 21:Sa(e,t,n);break;case 22:n.mode&1?(wr=(r=wr)||n.memoizedState!==null,Sa(e,t,n),wr=r):Sa(e,t,n);break;default:Sa(e,t,n)}}function cN(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new HF),t.forEach(function(r){var s=ZF.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ws(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~i}if(r=s,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*KF(r/1960))-r,10e?16:e,Ha===null)var r=!1;else{if(e=Ha,Ha=null,Rm=0,Pt&6)throw Error(Oe(331));var s=Pt;for(Pt|=4,ze=e.current;ze!==null;){var i=ze,a=i.child;if(ze.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cDn()-lw?Ho(e,0):ow|=n),Xr(e,t)}function aO(e,t){t===0&&(e.mode&1?(t=Dh,Dh<<=1,!(Dh&130023424)&&(Dh=4194304)):t=1);var n=Dr();e=da(e,t),e!==null&&(Uf(e,t,n),Xr(e,n))}function QF(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aO(e,n)}function ZF(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Oe(314))}r!==null&&r.delete(t),aO(e,n)}var oO;oO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Wr.current)Yr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yr=!1,FF(e,t,n);Yr=!!(e.flags&131072)}else Yr=!1,yn&&t.flags&1048576&&dR(t,vm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bp(e,t),e=t.pendingProps;var s=Ac(t,Nr.current);pc(t,n),s=tw(null,t,r,e,s,n);var i=nw();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qr(r)?(i=!0,xm(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Xx(t),s.updater=Lg,t.stateNode=s,s._reactInternals=t,C1(t,r,e,n),t=O1(null,t,r,!0,i,n)):(t.tag=0,yn&&i&&zx(t),Or(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=e9(r),e=Zs(r,e),s){case 0:t=R1(null,t,r,e,n);break e;case 1:t=sN(null,t,r,e,n);break e;case 11:t=nN(null,t,r,e,n);break e;case 14:t=rN(null,t,r,Zs(r.type,e),n);break e}throw Error(Oe(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),R1(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),sN(e,t,r,s,n);case 3:e:{if(VR(t),e===null)throw Error(Oe(387));r=t.pendingProps,i=t.memoizedState,s=i.element,yR(e,t),Nm(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Oc(Error(Oe(423)),t),t=iN(e,t,r,n,s);break e}else if(r!==s){s=Oc(Error(Oe(424)),t),t=iN(e,t,r,n,s);break e}else for(cs=Wa(t.stateNode.containerInfo.firstChild),us=t,yn=!0,ti=null,n=mR(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cc(),r===s){t=fa(e,t,n);break e}Or(e,t,r,n)}t=t.child}return t;case 5:return bR(t),e===null&&S1(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,w1(r,s)?a=null:i!==null&&w1(r,i)&&(t.flags|=32),zR(e,t),Or(e,t,a,n),t.child;case 6:return e===null&&S1(t),null;case 13:return KR(e,t,n);case 4:return Qx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ic(t,null,r,n):Or(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),nN(e,t,r,s,n);case 7:return Or(e,t,t.pendingProps,n),t.child;case 8:return Or(e,t,t.pendingProps.children,n),t.child;case 12:return Or(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,nn(_m,r._currentValue),r._currentValue=a,i!==null)if(fi(i.value,a)){if(i.children===s.children&&!Wr.current){t=fa(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=ia(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),T1(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Oe(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),T1(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Or(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,pc(t,n),s=Bs(s),r=r(s),t.flags|=1,Or(e,t,r,n),t.child;case 14:return r=t.type,s=Zs(r,t.pendingProps),s=Zs(r.type,s),rN(e,t,r,s,n);case 15:return $R(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Zs(r,s),Bp(e,t),t.tag=1,qr(r)?(e=!0,xm(t)):e=!1,pc(t,n),BR(t,r,s),C1(t,r,s,n),O1(null,t,r,!0,e,n);case 19:return YR(e,t,n);case 22:return HR(e,t,n)}throw Error(Oe(156,t.tag))};function lO(e,t){return jI(e,t)}function JF(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ls(e,t,n,r){return new JF(e,t,n,r)}function fw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function e9(e){if(typeof e=="function")return fw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Rx)return 11;if(e===Ox)return 14}return 2}function Za(e,t){var n=e.alternate;return n===null?(n=Ls(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $p(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")fw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ul:return zo(n.children,s,i,t);case Ix:a=8,s|=8;break;case Jb:return e=Ls(12,n,t,s|2),e.elementType=Jb,e.lanes=i,e;case e1:return e=Ls(13,n,t,s),e.elementType=e1,e.lanes=i,e;case t1:return e=Ls(19,n,t,s),e.elementType=t1,e.lanes=i,e;case bI:return Dg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case gI:a=10;break e;case yI:a=9;break e;case Rx:a=11;break e;case Ox:a=14;break e;case Ma:a=16,r=null;break e}throw Error(Oe(130,e==null?e:typeof e,""))}return t=Ls(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function zo(e,t,n,r){return e=Ls(7,e,r,t),e.lanes=n,e}function Dg(e,t,n,r){return e=Ls(22,e,r,t),e.elementType=bI,e.lanes=n,e.stateNode={isHidden:!1},e}function ky(e,t,n){return e=Ls(6,e,null,t),e.lanes=n,e}function Ny(e,t,n){return t=Ls(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function t9(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=iy(0),this.expirationTimes=iy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=iy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function hw(e,t,n,r,s,i,a,o,c){return e=new t9(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ls(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xx(i),e}function n9(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fO)}catch(e){console.error(e)}}fO(),fI.exports=gs;var Us=fI.exports,yN=Us;Qb.createRoot=yN.createRoot,Qb.hydrateRoot=yN.hydrateRoot;const yw=E.createContext({});function $g(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}const Hg=E.createContext(null),df=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class o9 extends E.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function l9({children:e,isPresent:t}){const n=E.useId(),r=E.useRef(null),s=E.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=E.useContext(df);return E.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=s.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -46,7 +46,7 @@ Error generating stack: `+i.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),l.jsx(o9,{isPresent:t,childRef:r,sizeRef:s,children:E.cloneElement(e,{ref:r})})}const c9=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const o=$g(u9),c=E.useId(),u=E.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=E.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),i?[Math.random(),u]:[n,u]);return E.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),E.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=l.jsx(l9,{isPresent:n,children:e})),l.jsx(Hg.Provider,{value:d,children:e})};function u9(){return new Map}function hO(e=!0){const t=E.useContext(Hg);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=E.useId();E.useEffect(()=>{e&&s(i)},[e]);const a=E.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const Wh=e=>e.key||"";function bN(e){const t=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&t.push(n)}),t}const bw=typeof window<"u",pO=bw?E.useLayoutEffect:E.useEffect,ni=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[o,c]=hO(a),u=E.useMemo(()=>bN(e),[e]),d=a&&!o?[]:u.map(Wh),f=E.useRef(!0),h=E.useRef(u),p=$g(()=>new Map),[m,g]=E.useState(u),[x,y]=E.useState(u);pO(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=Wh(_),N=a&&!o?!1:u===x||d.includes(k),A=()=>{if(p.has(k))p.set(k,!0);else return;let S=!0;p.forEach(C=>{C||(S=!1)}),S&&(b==null||b(),y(h.current),a&&(c==null||c()),r&&r())};return l.jsx(c9,{isPresent:N,initial:!f.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:A,children:_},k)})})},ds=e=>e;let mO=ds;const d9={useManualTiming:!1};function f9(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const qh=["read","resolveKeyframes","update","preRender","render","postRender"],h9=40;function gO(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=qh.reduce((y,w)=>(y[w]=f9(i),y),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(y-s.timestamp,h9),1),s.timestamp=y,s.isProcessing=!0,o.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:qh.reduce((y,w)=>{const b=a[w];return y[w]=(_,k=!1,N=!1)=>(n||m(),b.schedule(_,k,N)),y},{}),cancel:y=>{for(let w=0;wEN[e].some(n=>!!t[n])};function p9(e){for(const t in e)Lc[t]={...Lc[t],...e[t]}}const m9=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Mm(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m9.has(e)}let bO=e=>!Mm(e);function EO(e){e&&(bO=t=>t.startsWith("on")?!Mm(t):e(t))}try{EO(require("@emotion/is-prop-valid").default)}catch{}function g9(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(bO(s)||n===!0&&Mm(s)||!t&&!Mm(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function y9({children:e,isValidProp:t,...n}){t&&EO(t),n={...E.useContext(uf),...n},n.isStatic=$g(()=>n.isStatic);const r=E.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(uf.Provider,{value:r,children:e})}function b9(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const zg=E.createContext({});function df(e){return typeof e=="string"||Array.isArray(e)}function Vg(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Ew=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],xw=["initial",...Ew];function Kg(e){return Vg(e.animate)||xw.some(t=>df(e[t]))}function xO(e){return!!(Kg(e)||e.variants)}function E9(e,t){if(Kg(e)){const{initial:n,animate:r}=e;return{initial:n===!1||df(n)?n:void 0,animate:df(r)?r:void 0}}return e.inherit!==!1?t:{}}function x9(e){const{initial:t,animate:n}=E9(e,E.useContext(zg));return E.useMemo(()=>({initial:t,animate:n}),[xN(t),xN(n)])}function xN(e){return Array.isArray(e)?e.join(" "):e}const w9=Symbol.for("motionComponentSymbol");function Ql(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function v9(e,t,n){return E.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ql(n)&&(n.current=r))},[t])}const ww=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),_9="framerAppearId",wO="data-"+ww(_9),{schedule:vw}=gO(queueMicrotask,!1),vO=E.createContext({});function k9(e,t,n,r,s){var i,a;const{visualElement:o}=E.useContext(zg),c=E.useContext(yO),u=E.useContext(Hg),d=E.useContext(uf).reducedMotion,f=E.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=E.useContext(vO);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&N9(f.current,n,s,p);const m=E.useRef(!1);E.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const g=n[wO],x=E.useRef(!!g&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return pO(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),vw.render(h.render),x.current&&h.animationState&&h.animationState.animateChanges())}),E.useEffect(()=>{h&&(!x.current&&h.animationState&&h.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),x.current=!1))}),h}function N9(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:_O(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&Ql(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function _O(e){if(e)return e.options.allowProjection!==!1?e.projection:_O(e.parent)}function S9({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,a;e&&p9(e);function o(u,d){let f;const h={...E.useContext(uf),...u,layoutId:T9(u)},{isStatic:p}=h,m=x9(u),g=r(u,p);if(!p&&bw){A9();const x=C9(h);f=x.MeasureLayout,m.visualElement=k9(s,g,h,t,x.ProjectionNode)}return l.jsxs(zg.Provider,{value:m,children:[f&&m.visualElement?l.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,v9(g,m.visualElement,d),g,p,m.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const c=E.forwardRef(o);return c[w9]=s,c}function T9({layoutId:e}){const t=E.useContext(yw).id;return t&&e!==void 0?t+"-"+e:e}function A9(e,t){E.useContext(yO).strict}function C9(e){const{drag:t,layout:n}=Lc;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const I9=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function _w(e){return typeof e!="string"||e.includes("-")?!1:!!(I9.indexOf(e)>-1||/[A-Z]/u.test(e))}function wN(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function kw(e,t,n,r){if(typeof t=="function"){const[s,i]=wN(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=wN(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const V1=e=>Array.isArray(e),R9=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),O9=e=>V1(e)?e[e.length-1]||0:e,vr=e=>!!(e&&e.getVelocity);function Hp(e){const t=vr(e)?e.get():e;return R9(t)?t.toValue():t}function L9({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const a={latestValues:M9(r,s,i,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const kO=e=>(t,n)=>{const r=E.useContext(zg),s=E.useContext(Hg),i=()=>L9(e,t,r,s);return n?i():$g(i)};function M9(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Hp(i[h]);let{initial:a,animate:o}=e;const c=Kg(e),u=xO(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!Vg(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),SO=NO("--"),j9=NO("var(--"),Nw=e=>j9(e)?D9.test(e.split("/*")[0].trim()):!1,D9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,TO=(e,t)=>t&&typeof e=="number"?t.transform(e):e,ha=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},ff={...ou,transform:e=>ha(0,1,e)},Xh={...ou,default:1},Vf=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ra=Vf("deg"),Li=Vf("%"),rt=Vf("px"),P9=Vf("vh"),B9=Vf("vw"),vN={...Li,parse:e=>Li.parse(e)/100,transform:e=>Li.transform(e*100)},F9={borderWidth:rt,borderTopWidth:rt,borderRightWidth:rt,borderBottomWidth:rt,borderLeftWidth:rt,borderRadius:rt,radius:rt,borderTopLeftRadius:rt,borderTopRightRadius:rt,borderBottomRightRadius:rt,borderBottomLeftRadius:rt,width:rt,maxWidth:rt,height:rt,maxHeight:rt,top:rt,right:rt,bottom:rt,left:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,backgroundPositionX:rt,backgroundPositionY:rt},U9={rotate:Ra,rotateX:Ra,rotateY:Ra,rotateZ:Ra,scale:Xh,scaleX:Xh,scaleY:Xh,scaleZ:Xh,skew:Ra,skewX:Ra,skewY:Ra,distance:rt,translateX:rt,translateY:rt,translateZ:rt,x:rt,y:rt,z:rt,perspective:rt,transformPerspective:rt,opacity:ff,originX:vN,originY:vN,originZ:rt},_N={...ou,transform:Math.round},Sw={...F9,...U9,zIndex:_N,size:rt,fillOpacity:ff,strokeOpacity:ff,numOctaves:_N},$9={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},H9=au.length;function z9(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),AO=()=>({...Cw(),attrs:{}}),Iw=e=>typeof e=="string"&&e.toLowerCase()==="svg";function CO(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const IO=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function RO(e,t,n,r){CO(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(IO.has(s)?s:ww(s),t.attrs[s])}const jm={};function W9(e){Object.assign(jm,e)}function OO(e,{layout:t,layoutId:n}){return hl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!jm[e]||e==="opacity")}function Rw(e,t,n){var r;const{style:s}=e,i={};for(const a in s)(vr(s[a])||t.style&&vr(t.style[a])||OO(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function LO(e,t,n){const r=Rw(e,t,n);for(const s in e)if(vr(e[s])||vr(t[s])){const i=au.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function q9(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const NN=["x","y","width","height","cx","cy","r"],X9={useVisualState:kO({scrapeMotionValuesFromProps:LO,createRenderState:AO,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const o in s)if(hl.has(o)){i=!0;break}}if(!i)return;let a=!t;if(t)for(let o=0;o{q9(n,r),cn.render(()=>{Aw(r,s,Iw(n.tagName),e.transformTemplate),RO(n,r)})})}})},Q9={useVisualState:kO({scrapeMotionValuesFromProps:Rw,createRenderState:Cw})};function MO(e,t,n){for(const r in t)!vr(t[r])&&!OO(r,n)&&(e[r]=t[r])}function Z9({transformTemplate:e},t){return E.useMemo(()=>{const n=Cw();return Tw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function J9(e,t){const n=e.style||{},r={};return MO(r,n,e),Object.assign(r,Z9(e,t)),r}function eU(e,t){const n={},r=J9(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function tU(e,t,n,r){const s=E.useMemo(()=>{const i=AO();return Aw(i,t,Iw(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};MO(i,e.style,e),s.style={...i,...s.style}}return s}function nU(e=!1){return(n,r,s,{latestValues:i},a)=>{const c=(_w(n)?tU:eU)(r,i,a,n),u=g9(r,typeof n=="string",e),d=n!==E.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=E.useMemo(()=>vr(f)?f.get():f,[f]);return E.createElement(n,{...d,children:h})}}function rU(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={..._w(r)?X9:Q9,preloadedFeatures:e,useRender:nU(s),createVisualElement:t,Component:r};return S9(a)}}function jO(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(zp===void 0&&Mi.set(hr.isProcessing||d9.useManualTiming?hr.timestamp:performance.now()),zp),set:e=>{zp=e,queueMicrotask(sU)}};function Lw(e,t){e.indexOf(t)===-1&&e.push(t)}function Mw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class jw{constructor(){this.subscriptions=[]}add(t){return Lw(this.subscriptions,t),()=>Mw(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class aU{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Mi.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Mi.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=iU(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new jw);const r=this.events[t].add(n);return t==="change"?()=>{r(),cn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Mi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>SN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,SN);return PO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function hf(e,t){return new aU(e,t)}function oU(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,hf(n))}function lU(e,t){const n=Yg(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=O9(i[a]);oU(e,a,o)}}function cU(e){return!!(vr(e)&&e.add)}function K1(e,t){const n=e.getValue("willChange");if(cU(n))return n.add(t)}function BO(e){return e.props[wO]}function Dw(e){let t;return()=>(t===void 0&&(t=e()),t)}const uU=Dw(()=>window.ScrollTimeline!==void 0);class dU{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(uU()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class fU extends dU{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const aa=e=>e*1e3,oa=e=>e/1e3;function Pw(e){return typeof e=="function"}function TN(e,t){e.timeline=t,e.onfinish=null}const Bw=e=>Array.isArray(e)&&typeof e[0]=="number",hU={linearEasing:void 0};function pU(e,t){const n=Dw(e);return()=>{var r;return(r=hU[t])!==null&&r!==void 0?r:n()}}const Dm=pU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Mc=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},FO=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Y1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:sd([0,.65,.55,1]),circOut:sd([.55,0,1,.45]),backIn:sd([.31,.01,.66,-.59]),backOut:sd([.33,1.53,.69,.99])};function $O(e,t){if(e)return typeof e=="function"&&Dm()?FO(e,t):Bw(e)?sd(e):Array.isArray(e)?e.map(n=>$O(n,t)||Y1.easeOut):Y1[e]}const HO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,mU=1e-7,gU=12;function yU(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=HO(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>mU&&++oyU(i,0,1,e,n);return i=>i===0||i===1?i:HO(s(i),t,r)}const zO=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,VO=e=>t=>1-e(1-t),KO=Kf(.33,1.53,.69,.99),Fw=VO(KO),YO=zO(Fw),GO=e=>(e*=2)<1?.5*Fw(e):.5*(2-Math.pow(2,-10*(e-1))),Uw=e=>1-Math.sin(Math.acos(e)),WO=VO(Uw),qO=zO(Uw),XO=e=>/^0[^.\s]+$/u.test(e);function bU(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||XO(e):!0}const Nd=e=>Math.round(e*1e5)/1e5,$w=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function EU(e){return e==null}const xU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Hw=(e,t)=>n=>!!(typeof n=="string"&&xU.test(n)&&n.startsWith(e)||t&&!EU(n)&&Object.prototype.hasOwnProperty.call(n,t)),QO=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match($w);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},wU=e=>ha(0,255,e),Ty={...ou,transform:e=>Math.round(wU(e))},Po={test:Hw("rgb","red"),parse:QO("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Ty.transform(e)+", "+Ty.transform(t)+", "+Ty.transform(n)+", "+Nd(ff.transform(r))+")"};function vU(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const G1={test:Hw("#"),parse:vU,transform:Po.transform},Zl={test:Hw("hsl","hue"),parse:QO("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Li.transform(Nd(t))+", "+Li.transform(Nd(n))+", "+Nd(ff.transform(r))+")"},xr={test:e=>Po.test(e)||G1.test(e)||Zl.test(e),parse:e=>Po.test(e)?Po.parse(e):Zl.test(e)?Zl.parse(e):G1.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Po.transform(e):Zl.transform(e)},_U=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function kU(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match($w))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(_U))===null||n===void 0?void 0:n.length)||0)>0}const ZO="number",JO="color",NU="var",SU="var(",AN="${}",TU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function pf(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(TU,c=>(xr.test(c)?(r.color.push(i),s.push(JO),n.push(xr.parse(c))):c.startsWith(SU)?(r.var.push(i),s.push(NU),n.push(c)):(r.number.push(i),s.push(ZO),n.push(parseFloat(c))),++i,AN)).split(AN);return{values:n,split:o,indexes:r,types:s}}function eL(e){return pf(e).values}function tL(e){const{split:t,types:n}=pf(e),r=t.length;return s=>{let i="";for(let a=0;atypeof e=="number"?0:e;function CU(e){const t=eL(e);return tL(e)(t.map(AU))}const io={test:kU,parse:eL,createTransformer:tL,getAnimatableNone:CU},IU=new Set(["brightness","contrast","saturate","opacity"]);function RU(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match($w)||[];if(!r)return e;const s=n.replace(r,"");let i=IU.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const OU=/\b([a-z-]*)\(.*?\)/gu,W1={...io,getAnimatableNone:e=>{const t=e.match(OU);return t?t.map(RU).join(" "):e}},LU={...Sw,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:W1,WebkitFilter:W1},zw=e=>LU[e];function nL(e,t){let n=zw(e);return n!==W1&&(n=io),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const MU=new Set(["auto","none","0"]);function jU(e,t,n){let r=0,s;for(;re===ou||e===rt,IN=(e,t)=>parseFloat(e.split(", ")[t]),RN=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return IN(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?IN(i[1],e):0}},DU=new Set(["x","y","z"]),PU=au.filter(e=>!DU.has(e));function BU(e){const t=[];return PU.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const jc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:RN(4,13),y:RN(5,14)};jc.translateX=jc.x;jc.translateY=jc.y;const Vo=new Set;let q1=!1,X1=!1;function rL(){if(X1){const e=Array.from(Vo).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=BU(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}X1=!1,q1=!1,Vo.forEach(e=>e.complete()),Vo.clear()}function sL(){Vo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(X1=!0)})}function FU(){sL(),rL()}class Vw{constructor(t,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Vo.add(this),q1||(q1=!0,cn.read(sL),cn.resolveKeyframes(rL))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),UU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function $U(e){const t=UU.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function aL(e,t,n=1){const[r,s]=$U(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return iL(a)?parseFloat(a):a}return Nw(s)?aL(s,t,n+1):s}const oL=e=>t=>t.test(e),HU={test:e=>e==="auto",parse:e=>e},lL=[ou,rt,Li,Ra,B9,P9,HU],ON=e=>lL.find(oL(e));class cL extends Vw{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const LN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(io.test(e)||e==="0")&&!e.startsWith("url("));function zU(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Gg(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(KU),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const YU=40;class uL{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Mi.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>YU?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&FU(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Mi.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!VU(t,r,s,i))if(a)this.options.duration=0;else{c&&c(Gg(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Q1=2e4;function dL(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=Q1?1/0:t}const Sn=(e,t,n)=>e+(t-e)*n;function Ay(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function GU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;s=Ay(c,o,e+1/3),i=Ay(c,o,e),a=Ay(c,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function Pm(e,t){return n=>n>0?t:e}const Cy=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},WU=[G1,Po,Zl],qU=e=>WU.find(t=>t.test(e));function MN(e){const t=qU(e);if(!t)return!1;let n=t.parse(e);return t===Zl&&(n=GU(n)),n}const jN=(e,t)=>{const n=MN(e),r=MN(t);if(!n||!r)return Pm(e,t);const s={...n};return i=>(s.red=Cy(n.red,r.red,i),s.green=Cy(n.green,r.green,i),s.blue=Cy(n.blue,r.blue,i),s.alpha=Sn(n.alpha,r.alpha,i),Po.transform(s))},XU=(e,t)=>n=>t(e(n)),Yf=(...e)=>e.reduce(XU),Z1=new Set(["none","hidden"]);function QU(e,t){return Z1.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ZU(e,t){return n=>Sn(e,t,n)}function Kw(e){return typeof e=="number"?ZU:typeof e=="string"?Nw(e)?Pm:xr.test(e)?jN:t$:Array.isArray(e)?fL:typeof e=="object"?xr.test(e)?jN:JU:Pm}function fL(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>Kw(i)(i,t[a]));return i=>{for(let a=0;a{for(const i in r)n[i]=r[i](s);return n}}function e$(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=io.createTransformer(t),r=pf(e),s=pf(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Z1.has(e)&&!s.values.length||Z1.has(t)&&!r.values.length?QU(e,t):Yf(fL(e$(r,s),s.values),n):Pm(e,t)};function hL(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Sn(e,t,n):Kw(e)(e,t)}const n$=5;function pL(e,t,n){const r=Math.max(t-n$,0);return PO(n-e(r),t-r)}const Rn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Iy=.001;function r$({duration:e=Rn.duration,bounce:t=Rn.bounce,velocity:n=Rn.velocity,mass:r=Rn.mass}){let s,i,a=1-t;a=ha(Rn.minDamping,Rn.maxDamping,a),e=ha(Rn.minDuration,Rn.maxDuration,oa(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=J1(u,a),m=Math.exp(-f);return Iy-h/p*m},i=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),g=J1(Math.pow(u,2),a);return(-s(u)+Iy>0?-1:1)*((h-p)*m)/g}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Iy+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=i$(s,i,o);if(e=aa(e),isNaN(c))return{stiffness:Rn.stiffness,damping:Rn.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const s$=12;function i$(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function l$(e){let t={velocity:Rn.velocity,stiffness:Rn.stiffness,damping:Rn.damping,mass:Rn.mass,isResolvedFromDuration:!1,...e};if(!DN(e,o$)&&DN(e,a$))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*ha(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Rn.mass,stiffness:s,damping:i}}else{const n=r$(e);t={...t,...n,mass:Rn.mass},t.isResolvedFromDuration=!0}return t}function mL(e=Rn.visualDuration,t=Rn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=l$({...n,velocity:-oa(n.velocity||0)}),m=h||0,g=u/(2*Math.sqrt(c*d)),x=a-i,y=oa(Math.sqrt(c/d)),w=Math.abs(x)<5;r||(r=w?Rn.restSpeed.granular:Rn.restSpeed.default),s||(s=w?Rn.restDelta.granular:Rn.restDelta.default);let b;if(g<1){const k=J1(y,g);b=N=>{const A=Math.exp(-g*y*N);return a-A*((m+g*y*x)/k*Math.sin(k*N)+x*Math.cos(k*N))}}else if(g===1)b=k=>a-Math.exp(-y*k)*(x+(m+y*x)*k);else{const k=y*Math.sqrt(g*g-1);b=N=>{const A=Math.exp(-g*y*N),S=Math.min(k*N,300);return a-A*((m+g*y*x)*Math.sinh(S)+k*x*Math.cosh(S))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const N=b(k);if(p)o.done=k>=f;else{let A=0;g<1&&(A=k===0?aa(m):pL(b,k,N));const S=Math.abs(A)<=r,C=Math.abs(a-N)<=s;o.done=S&&C}return o.value=o.done?a:N,o},toString:()=>{const k=Math.min(dL(_),Q1),N=FO(A=>_.next(k*A).value,k,30);return k+"ms "+N}};return _}function PN({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>o!==void 0&&Sc,m=S=>o===void 0?c:c===void 0||Math.abs(o-S)-g*Math.exp(-S/r),b=S=>y+w(S),_=S=>{const C=w(S),R=b(S);h.done=Math.abs(C)<=u,h.value=h.done?y:R};let k,N;const A=S=>{p(h.value)&&(k=S,N=mL({keyframes:[h.value,m(h.value)],velocity:pL(b,S,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return A(0),{calculatedDuration:null,next:S=>{let C=!1;return!N&&k===void 0&&(C=!0,_(S),A(S)),k!==void 0&&S>=k?N.next(S-k):(!C&&_(S),h)}}}const c$=Kf(.42,0,1,1),u$=Kf(0,0,.58,1),gL=Kf(.42,0,.58,1),d$=e=>Array.isArray(e)&&typeof e[0]!="number",f$={linear:ds,easeIn:c$,easeInOut:gL,easeOut:u$,circIn:Uw,circInOut:qO,circOut:WO,backIn:Fw,backInOut:YO,backOut:KO,anticipate:GO},BN=e=>{if(Bw(e)){mO(e.length===4);const[t,n,r,s]=e;return Kf(t,n,r,s)}else if(typeof e=="string")return f$[e];return e};function h$(e,t,n){const r=[],s=n||hL,i=e.length-1;for(let a=0;at[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=h$(t,r,s),c=o.length,u=d=>{if(a&&d1)for(;fu(ha(e[0],e[i-1],d)):u}function m$(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=Mc(0,t,r);e.push(Sn(n,1,s))}}function g$(e){const t=[0];return m$(t,e.length-1),t}function y$(e,t){return e.map(n=>n*t)}function b$(e,t){return e.map(()=>t||gL).splice(0,e.length-1)}function Bm({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=d$(r)?r.map(BN):BN(r),i={done:!1,value:t[0]},a=y$(n&&n.length===t.length?n:g$(t),e),o=p$(a,t,{ease:Array.isArray(s)?s:b$(t,s)});return{calculatedDuration:e,next:c=>(i.value=o(c),i.done=c>=e,i)}}const E$=e=>{const t=({timestamp:n})=>e(n);return{start:()=>cn.update(t,!0),stop:()=>so(t),now:()=>hr.isProcessing?hr.timestamp:Mi.now()}},x$={decay:PN,inertia:PN,tween:Bm,keyframes:Bm,spring:mL},w$=e=>e/100;class Yw extends uL{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||Vw,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,o,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,o=Pw(n)?n:x$[n]||Bm;let c,u;o!==Bm&&typeof t[0]!="number"&&(c=Yf(w$,hL(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});i==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=dL(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:g,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),w=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let b=this.currentTime,_=i;if(p){const S=Math.min(this.currentTime,d)/f;let C=Math.floor(S),R=S%1;!R&&S>=1&&(R=1),R===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(R=1-R,g&&(R-=g/f)):m==="mirror"&&(_=a)),b=ha(0,1,R)*f}const k=w?{done:!1,value:c[0]}:_.next(b);o&&(k.value=o(k.value));let{done:N}=k;!w&&u!==null&&(N=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return A&&s!==void 0&&(k.value=Gg(c,this.options,s)),x&&x(k.value),A&&this.finish(),k}get duration(){const{resolved:t}=this;return t?oa(t.calculatedDuration):0}get time(){return oa(this.currentTime)}set time(t){t=aa(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=oa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=E$,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const v$=new Set(["opacity","clipPath","filter","transform"]);function _$(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=$O(o,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const k$=Dw(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Fm=10,N$=2e4;function S$(e){return Pw(e.type)||e.type==="spring"||!UO(e.ease)}function T$(e,t){const n=new Yw({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(a,o),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i=="string"&&Dm()&&A$(i)&&(i=yL[i]),S$(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...g}=this.options,x=T$(t,g);t=x.keyframes,t.length===1&&(t[1]=t[0]),r=x.duration,s=x.times,i=x.ease,a="keyframes"}const d=_$(o.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(TN(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(Gg(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return oa(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return oa(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=aa(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ds;const{animation:r}=n;TN(r,t)}return ds}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new Yw({...p,keyframes:r,duration:s,type:i,ease:a,times:o,isGenerator:!0}),g=aa(this.time);u.setWithVelocity(m.sample(g-Fm).value,m.sample(g).value,Fm)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return k$()&&r&&v$.has(r)&&!c&&!u&&!s&&i!=="mirror"&&a!==0&&o!=="inertia"}}const C$={type:"spring",stiffness:500,damping:25,restSpeed:10},I$=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),R$={type:"keyframes",duration:.8},O$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},L$=(e,{keyframes:t})=>t.length>2?R$:hl.has(e)?e.startsWith("scale")?I$(t[1]):C$:O$;function M$({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Gw=(e,t,n,r={},s,i)=>a=>{const o=Ow(r,e)||{},c=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-aa(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};M$(o)||(d={...d,...L$(e,d)}),d.duration&&(d.duration=aa(d.duration)),d.repeatDelay&&(d.repeatDelay=aa(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Gg(d.keyframes,o);if(h!==void 0)return cn.update(()=>{d.onUpdate(h),d.onComplete()}),new fU([])}return!i&&FN.supports(d)?new FN(d):new Yw(d)};function j$({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function bL(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;r&&(a=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&j$(d,f))continue;const m={delay:n,...Ow(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=BO(e);if(y){const w=window.MotionHandoffAnimation(y,f,cn);w!==null&&(m.startTime=w,g=!0)}}K1(e,f),h.start(Gw(f,h,p,e.shouldReduceMotion&&DO.has(f)?{type:!1}:m,e,g));const x=h.animation;x&&u.push(x)}return o&&Promise.all(u).then(()=>{cn.update(()=>{o&&lU(e,o)})}),u}function eE(e,t,n={}){var r;const s=Yg(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(bL(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return D$(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function D$(e,t,n=0,r=0,s=1,i){const a=[],o=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(P$).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(eE(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function P$(e,t){return e.sortNodePosition(t)}function B$(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>eE(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=eE(e,t,n);else{const s=typeof t=="function"?Yg(e,t,n.custom):t;r=Promise.all(bL(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const F$=xw.length;function EL(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?EL(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>B$(e,n,r)))}function z$(e){let t=H$(e),n=UN(),r=!0;const s=c=>(u,d)=>{var f;const h=Yg(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...g}=h;u={...u,...g,...m}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=EL(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let x=0;x<$$;x++){const y=U$[x],w=n[y],b=u[y]!==void 0?u[y]:d[y],_=df(b),k=y===c?w.isActive:null;k===!1&&(m=x);let N=b===d[y]&&b!==u[y]&&_;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),w.protectedKeys={...p},!w.isActive&&k===null||!b&&!w.prevProp||Vg(b)||typeof b=="boolean")continue;const A=V$(w.prevProp,b);let S=A||y===c&&w.isActive&&!N&&_||x>m&&_,C=!1;const R=Array.isArray(b)?b:[b];let O=R.reduce(s(y),{});k===!1&&(O={});const{prevResolvedValues:F={}}=w,q={...F,...O},L=M=>{S=!0,h.has(M)&&(C=!0,h.delete(M)),w.needsAnimating[M]=!0;const j=e.getValue(M);j&&(j.liveStyle=!1)};for(const M in q){const j=O[M],U=F[M];if(p.hasOwnProperty(M))continue;let I=!1;V1(j)&&V1(U)?I=!jO(j,U):I=j!==U,I?j!=null?L(M):h.add(M):j!==void 0&&h.has(M)?L(M):w.protectedKeys[M]=!0}w.prevProp=b,w.prevResolvedValues=O,w.isActive&&(p={...p,...O}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&A)||C)&&f.push(...R.map(M=>({animation:M,options:{type:y}})))}if(h.size){const x={};h.forEach(y=>{const w=e.getBaseTarget(y),b=e.getValue(y);b&&(b.liveStyle=!0),x[y]=w??null}),f.push({animation:x})}let g=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,g?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>n,reset:()=>{n=UN(),r=!0}}}function V$(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!jO(t,e):!1}function wo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function UN(){return{animate:wo(!0),whileInView:wo(),whileHover:wo(),whileTap:wo(),whileDrag:wo(),whileFocus:wo(),exit:wo()}}class co{constructor(t){this.isMounted=!1,this.node=t}update(){}}class K$ extends co{constructor(t){super(t),t.animationState||(t.animationState=z$(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Vg(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Y$=0;class G$ extends co{constructor(){super(...arguments),this.id=Y$++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const W$={animation:{Feature:K$},exit:{Feature:G$}},Qs={x:!1,y:!1};function xL(){return Qs.x||Qs.y}function q$(e){return e==="x"||e==="y"?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}const Ww=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function mf(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Gf(e){return{point:{x:e.pageX,y:e.pageY}}}const X$=e=>t=>Ww(t)&&e(t,Gf(t));function Sd(e,t,n,r){return mf(e,t,X$(n),r)}const $N=(e,t)=>Math.abs(e-t);function Q$(e,t){const n=$N(e.x,t.x),r=$N(e.y,t.y);return Math.sqrt(n**2+r**2)}class wL{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Oy(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=Q$(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:g}=hr;this.history.push({...m,timestamp:g});const{onStart:x,onMove:y}=this.handlers;h||(x&&x(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Ry(h,this.transformPagePoint),cn.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Oy(f.type==="pointercancel"?this.lastMoveEventInfo:Ry(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,x),m&&m(f,x)},!Ww(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Gf(t),o=Ry(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=hr;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Oy(o,this.history)),this.removeListeners=Yf(Sd(this.contextWindow,"pointermove",this.handlePointerMove),Sd(this.contextWindow,"pointerup",this.handlePointerUp),Sd(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),so(this.updatePoint)}}function Ry(e,t){return t?{point:t(e.point)}:e}function HN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Oy({point:e},t){return{point:e,delta:HN(e,vL(t)),offset:HN(e,Z$(t)),velocity:J$(t,.1)}}function Z$(e){return e[0]}function vL(e){return e[e.length-1]}function J$(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=vL(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>aa(t)));)n--;if(!r)return{x:0,y:0};const i=oa(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const _L=1e-4,e7=1-_L,t7=1+_L,kL=.01,n7=0-kL,r7=0+kL;function ps(e){return e.max-e.min}function s7(e,t,n){return Math.abs(e-t)<=n}function zN(e,t,n,r=.5){e.origin=r,e.originPoint=Sn(t.min,t.max,e.origin),e.scale=ps(n)/ps(t),e.translate=Sn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=e7&&e.scale<=t7||isNaN(e.scale))&&(e.scale=1),(e.translate>=n7&&e.translate<=r7||isNaN(e.translate))&&(e.translate=0)}function Td(e,t,n,r){zN(e.x,t.x,n.x,r?r.originX:void 0),zN(e.y,t.y,n.y,r?r.originY:void 0)}function VN(e,t,n){e.min=n.min+t.min,e.max=e.min+ps(t)}function i7(e,t,n){VN(e.x,t.x,n.x),VN(e.y,t.y,n.y)}function KN(e,t,n){e.min=t.min-n.min,e.max=e.min+ps(t)}function Ad(e,t,n){KN(e.x,t.x,n.x),KN(e.y,t.y,n.y)}function a7(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Sn(n,e,r.max):Math.min(e,n)),e}function YN(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function o7(e,{top:t,left:n,bottom:r,right:s}){return{x:YN(e.x,n,s),y:YN(e.y,t,r)}}function GN(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Mc(t.min,t.max-r,e.min):r>s&&(n=Mc(e.min,e.max-s,t.min)),ha(0,1,n)}function u7(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const tE=.35;function d7(e=tE){return e===!1?e=0:e===!0&&(e=tE),{x:WN(e,"left","right"),y:WN(e,"top","bottom")}}function WN(e,t,n){return{min:qN(e,t),max:qN(e,n)}}function qN(e,t){return typeof e=="number"?e:e[t]||0}const XN=()=>({translate:0,scale:1,origin:0,originPoint:0}),Jl=()=>({x:XN(),y:XN()}),QN=()=>({min:0,max:0}),jn=()=>({x:QN(),y:QN()});function Ss(e){return[e("x"),e("y")]}function NL({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function f7({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function h7(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ly(e){return e===void 0||e===1}function nE({scale:e,scaleX:t,scaleY:n}){return!Ly(e)||!Ly(t)||!Ly(n)}function So(e){return nE(e)||SL(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function SL(e){return ZN(e.x)||ZN(e.y)}function ZN(e){return e&&e!=="0%"}function Um(e,t,n){const r=e-n,s=t*r;return n+s}function JN(e,t,n,r,s){return s!==void 0&&(e=Um(e,s,r)),Um(e,n,r)+t}function rE(e,t=0,n=1,r,s){e.min=JN(e.min,t,n,r,s),e.max=JN(e.max,t,n,r,s)}function TL(e,{x:t,y:n}){rE(e.x,t.translate,t.scale,t.originPoint),rE(e.y,n.translate,n.scale,n.originPoint)}const eS=.999999999999,tS=1.0000000000001;function p7(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let o=0;oeS&&(t.x=1),t.yeS&&(t.y=1)}function ec(e,t){e.min=e.min+t,e.max=e.max+t}function nS(e,t,n,r,s=.5){const i=Sn(e.min,e.max,s);rE(e,t,n,i,r)}function tc(e,t){nS(e.x,t.x,t.scaleX,t.scale,t.originX),nS(e.y,t.y,t.scaleY,t.scale,t.originY)}function AL(e,t){return NL(h7(e.getBoundingClientRect(),t))}function m7(e,t,n){const r=AL(e,n),{scroll:s}=t;return s&&(ec(r.x,s.offset.x),ec(r.y,s.offset.y)),r}const CL=({current:e})=>e?e.ownerDocument.defaultView:null,g7=new WeakMap;class y7{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Gf(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=q$(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ss(x=>{let y=this.getAxisMotionValue(x).get()||0;if(Li.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const b=w.layout.layoutBox[x];b&&(y=ps(b)*(parseFloat(y)/100))}}this.originPoint[x]=y}),m&&cn.postRender(()=>m(d,f)),K1(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:x}=f;if(p&&this.currentDirection===null){this.currentDirection=b7(x),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,x),this.updateAxis("y",f.point,x),this.visualElement.render(),g&&g(d,f)},o=(d,f)=>this.stop(d,f),c=()=>Ss(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new wL(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:CL(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&cn.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Qh(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=a7(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Ql(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=o7(s.layoutBox,n):this.constraints=!1,this.elastic=d7(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ss(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=u7(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ql(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=m7(r,s.root,this.visualElement.getTransformPagePoint());let a=l7(s.layout.layoutBox,i);if(n){const o=n(f7(a));this.hasMutatedConstraints=!!o,o&&(a=NL(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=Ss(d=>{if(!Qh(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return K1(this.visualElement,t),r.start(Gw(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ss(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ss(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ss(n=>{const{drag:r}=this.getProps();if(!Qh(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n];i.set(t[n]-Sn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ql(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ss(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();s[a]=c7({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ss(a=>{if(!Qh(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(Sn(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;g7.set(this.visualElement,this);const t=this.visualElement.current,n=Sd(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Ql(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),cn.read(r);const a=mf(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ss(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=tE,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Qh(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function b7(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class E7 extends co{constructor(t){super(t),this.removeGroupControls=ds,this.removeListeners=ds,this.controls=new y7(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ds}unmount(){this.removeGroupControls(),this.removeListeners()}}const rS=e=>(t,n)=>{e&&cn.postRender(()=>e(t,n))};class x7 extends co{constructor(){super(...arguments),this.removePointerDownListener=ds}onPointerDown(t){this.session=new wL(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:CL(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:rS(t),onStart:rS(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&cn.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=Sd(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Vp={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function sS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Fu={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(rt.test(e))e=parseFloat(e);else return e;const n=sS(e,t.target.x),r=sS(e,t.target.y);return`${n}% ${r}%`}},w7={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=io.parse(e);if(s.length>5)return r;const i=io.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=c;const u=Sn(o,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class v7 extends E.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;W9(_7),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Vp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||cn.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),vw.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function IL(e){const[t,n]=hO(),r=E.useContext(yw);return l.jsx(v7,{...e,layoutGroup:r,switchLayoutGroup:E.useContext(vO),isPresent:t,safeToRemove:n})}const _7={borderRadius:{...Fu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Fu,borderTopRightRadius:Fu,borderBottomLeftRadius:Fu,borderBottomRightRadius:Fu,boxShadow:w7};function k7(e,t,n){const r=vr(e)?e:hf(e);return r.start(Gw("",r,t,n)),r.animation}function N7(e){return e instanceof SVGElement&&e.tagName!=="svg"}const S7=(e,t)=>e.depth-t.depth;class T7{constructor(){this.children=[],this.isDirty=!1}add(t){Lw(this.children,t),this.isDirty=!0}remove(t){Mw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(S7),this.isDirty=!1,this.children.forEach(t)}}function A7(e,t){const n=Mi.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(so(r),e(i-t))};return cn.read(r,!0),()=>so(r)}const RL=["TopLeft","TopRight","BottomLeft","BottomRight"],C7=RL.length,iS=e=>typeof e=="string"?parseFloat(e):e,aS=e=>typeof e=="number"||rt.test(e);function I7(e,t,n,r,s,i){s?(e.opacity=Sn(0,n.opacity!==void 0?n.opacity:1,R7(r)),e.opacityExit=Sn(t.opacity!==void 0?t.opacity:1,0,O7(r))):i&&(e.opacity=Sn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(Mc(e,t,r))}function lS(e,t){e.min=t.min,e.max=t.max}function Ns(e,t){lS(e.x,t.x),lS(e.y,t.y)}function cS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function uS(e,t,n,r,s){return e-=t,e=Um(e,1/n,r),s!==void 0&&(e=Um(e,1/s,r)),e}function L7(e,t=0,n=1,r=.5,s,i=e,a=e){if(Li.test(t)&&(t=parseFloat(t),t=Sn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=Sn(i.min,i.max,r);e===i&&(o-=t),e.min=uS(e.min,t,n,o,s),e.max=uS(e.max,t,n,o,s)}function dS(e,t,[n,r,s],i,a){L7(e,t[n],t[r],t[s],t.scale,i,a)}const M7=["x","scaleX","originX"],j7=["y","scaleY","originY"];function fS(e,t,n,r){dS(e.x,t,M7,n?n.x:void 0,r?r.x:void 0),dS(e.y,t,j7,n?n.y:void 0,r?r.y:void 0)}function hS(e){return e.translate===0&&e.scale===1}function LL(e){return hS(e.x)&&hS(e.y)}function pS(e,t){return e.min===t.min&&e.max===t.max}function D7(e,t){return pS(e.x,t.x)&&pS(e.y,t.y)}function mS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ML(e,t){return mS(e.x,t.x)&&mS(e.y,t.y)}function gS(e){return ps(e.x)/ps(e.y)}function yS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class P7{constructor(){this.members=[]}add(t){Lw(this.members,t),t.scheduleRender()}remove(t){if(Mw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function B7(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(r+=`scale(${o}, ${c})`),r||"none"}const To={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},id=typeof window<"u"&&window.MotionDebug!==void 0,My=["","X","Y","Z"],F7={visibility:"hidden"},bS=1e3;let U7=0;function jy(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function jL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=BO(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",cn,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&jL(r)}function DL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=U7++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,id&&(To.totalNodes=To.resolvedTargetDeltas=To.recalculatedProjection=0),this.nodes.forEach(z7),this.nodes.forEach(W7),this.nodes.forEach(q7),this.nodes.forEach(V7),id&&window.MotionDebug.record(To)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=A7(h,250),Vp.hasAnimatedSinceResize&&(Vp.hasAnimatedSinceResize=!1,this.nodes.forEach(xS))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||eH,{onLayoutAnimationStart:x,onLayoutAnimationComplete:y}=d.getProps(),w=!this.targetLayout||!ML(this.targetLayout,m)||p,b=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||h&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,b);const _={...Ow(g,"layout"),onPlay:x,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||xS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,so(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(X7),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&jL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const k=_/1e3;wS(f.x,a.x,k),wS(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ad(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Z7(this.relativeTarget,this.relativeTargetOrigin,h,k),b&&D7(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=jn()),Ns(b,this.relativeTarget)),g&&(this.animationValues=d,I7(d,u,this.latestValues,k,w,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(so(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=cn.update(()=>{Vp.hasAnimatedSinceResize=!0,this.currentAnimation=k7(0,bS,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&PL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||jn();const f=ps(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=ps(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Ns(o,c),tc(o,d),Td(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new P7),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&jy("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(ES),this.root.sharedNodes.clear()}}}function $7(e){e.updateLayout()}function H7(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=n.source!==e.layout.source;i==="size"?Ss(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ps(h);h.min=r[f].min,h.max=h.min+p}):PL(i,n.layoutBox,r)&&Ss(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ps(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=Jl();Td(o,r,n.layoutBox);const c=Jl();a?Td(c,e.applyTransform(s,!0),n.measuredBox):Td(c,r,n.layoutBox);const u=!LL(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=jn();Ad(m,n.layoutBox,h.layoutBox);const g=jn();Ad(g,r,p.layoutBox),ML(m,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function z7(e){id&&To.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function V7(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function K7(e){e.clearSnapshot()}function ES(e){e.clearMeasurements()}function Y7(e){e.isLayoutDirty=!1}function G7(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function xS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function W7(e){e.resolveTargetDelta()}function q7(e){e.calcProjection()}function X7(e){e.resetSkewAndRotation()}function Q7(e){e.removeLeadSnapshot()}function wS(e,t,n){e.translate=Sn(t.translate,0,n),e.scale=Sn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function vS(e,t,n,r){e.min=Sn(t.min,n.min,r),e.max=Sn(t.max,n.max,r)}function Z7(e,t,n,r){vS(e.x,t.x,n.x,r),vS(e.y,t.y,n.y,r)}function J7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const eH={duration:.45,ease:[.4,0,.1,1]},_S=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),kS=_S("applewebkit/")&&!_S("chrome/")?Math.round:ds;function NS(e){e.min=kS(e.min),e.max=kS(e.max)}function tH(e){NS(e.x),NS(e.y)}function PL(e,t,n){return e==="position"||e==="preserve-aspect"&&!s7(gS(t),gS(n),.2)}function nH(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const rH=DL({attachResizeListener:(e,t)=>mf(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dy={current:void 0},BL=DL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dy.current){const e=new rH({});e.mount(window),e.setOptions({layoutScroll:!0}),Dy.current=e}return Dy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),sH={pan:{Feature:x7},drag:{Feature:E7,ProjectionNode:BL,MeasureLayout:IL}};function iH(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function FL(e,t){const n=iH(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function SS(e){return t=>{t.pointerType==="touch"||xL()||e(t)}}function aH(e,t,n={}){const[r,s,i]=FL(e,n),a=SS(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=SS(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}function TS(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&cn.postRender(()=>i(t,Gf(t)))}class oH extends co{mount(){const{current:t}=this.node;t&&(this.unmount=aH(t,n=>(TS(this.node,n,"Start"),r=>TS(this.node,r,"End"))))}unmount(){}}class lH extends co{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yf(mf(this.node.current,"focus",()=>this.onFocus()),mf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const UL=(e,t)=>t?e===t?!0:UL(e,t.parentElement):!1,cH=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uH(e){return cH.has(e.tagName)||e.tabIndex!==-1}const ad=new WeakSet;function AS(e){return t=>{t.key==="Enter"&&e(t)}}function Py(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const dH=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=AS(()=>{if(ad.has(n))return;Py(n,"down");const s=AS(()=>{Py(n,"up")}),i=()=>Py(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function CS(e){return Ww(e)&&!xL()}function fH(e,t,n={}){const[r,s,i]=FL(e,n),a=o=>{const c=o.currentTarget;if(!CS(o)||ad.has(c))return;ad.add(c);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!CS(p)||!ad.has(c))&&(ad.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||UL(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(o=>{!uH(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",u=>dH(u,s),s)}),i}function IS(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&cn.postRender(()=>i(t,Gf(t)))}class hH extends co{mount(){const{current:t}=this.node;t&&(this.unmount=fH(t,n=>(IS(this.node,n,"Start"),(r,{success:s})=>IS(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const sE=new WeakMap,By=new WeakMap,pH=e=>{const t=sE.get(e.target);t&&t(e)},mH=e=>{e.forEach(pH)};function gH({root:e,...t}){const n=e||document;By.has(n)||By.set(n,{});const r=By.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(mH,{root:e,...t})),r[s]}function yH(e,t,n){const r=gH(t);return sE.set(e,n),r.observe(e),()=>{sE.delete(e),r.unobserve(e)}}const bH={some:0,all:1};class EH extends co{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:bH[s]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return yH(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(xH(t,n))&&this.startObserver()}unmount(){}}function xH({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const wH={inView:{Feature:EH},tap:{Feature:hH},focus:{Feature:lH},hover:{Feature:oH}},vH={layout:{ProjectionNode:BL,MeasureLayout:IL}},iE={current:null},$L={current:!1};function _H(){if($L.current=!0,!!bw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>iE.current=e.matches;e.addListener(t),t()}else iE.current=!1}const kH=[...lL,xr,io],NH=e=>kH.find(oL(e)),RS=new WeakMap;function SH(e,t,n){for(const r in t){const s=t[r],i=n[r];if(vr(s))e.addValue(r,s);else if(vr(i))e.addValue(r,hf(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,hf(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const OS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class TH{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Vw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Mi.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),$L.current||_H(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:iE.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){RS.delete(this.current),this.projection&&this.projection.unmount(),so(this.notifyUpdate),so(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=hl.has(t),s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&cn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Lc){const n=Lc[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=hf(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(iL(s)||XO(s))?s=parseFloat(s):!NH(s)&&io.test(n)&&(s=nL(t,n)),this.setBaseTarget(t,vr(s)?s.get():s)),vr(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=kw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!vr(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new jw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class HL extends TH{constructor(){super(...arguments),this.KeyframeResolver=cL}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;vr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function AH(e){return window.getComputedStyle(e)}class CH extends HL{constructor(){super(...arguments),this.type="html",this.renderInstance=CO}readValueFromInstance(t,n){if(hl.has(n)){const r=zw(n);return r&&r.default||0}else{const r=AH(t),s=(SO(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return AL(t,n)}build(t,n,r){Tw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Rw(t,n,r)}}class IH extends HL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(hl.has(n)){const r=zw(n);return r&&r.default||0}return n=IO.has(n)?n:ww(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return LO(t,n,r)}build(t,n,r){Aw(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){RO(t,n,r,s)}mount(t){this.isSVGTag=Iw(t.tagName),super.mount(t)}}const RH=(e,t)=>_w(e)?new IH(t):new CH(t,{allowProjection:e!==E.Fragment}),OH=rU({...W$,...wH,...sH,...vH},RH),Wt=b9(OH);function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?E.useEffect:E.useLayoutEffect;function jl(e,t,n){var r=E.useRef(t);r.current=t,E.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var LH=["container"];function MH(e){var t=e.container,n=t===void 0?document.body:t,r=Wg(e,LH);return Us.createPortal(wt.createElement("div",qn({},r)),n)}function jH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function DH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function PH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function BH(){return E.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function MS(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,a=s.clientY;return[(n+i)/2,(r+a)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Da=function(e,t,n,r){var s,i=n*t,a=(i-r)/2,o=e;return i<=r?(s=1,o=0):e>0&&a-e<=0?(s=2,o=a):e<0&&a+e<=0&&(s=3,o=-a),[s,o]};function Fy(e,t,n,r,s,i,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Da(e,i,n,innerWidth)[0],f=Da(t,i,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-i/s*(a-(h+e))-h+(r/n>=3&&n*i===innerWidth?0:d?c/2:c),y:o-i/s*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function lE(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function Uy(e,t,n){var r=lE(n,innerWidth,innerHeight),s=r[0],i=r[1],a=0,o=s,c=i,u=e/t*i,d=t/e*s;return e=i?o=u:e>=s&&ts/i?c=d:t/e>=3&&!r[2]?a=((c=d)-i)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function Jh(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,a=i===void 0?s||0:i,o=E.useRef(e);o.current=e;var c=E.useRef(0),u=E.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=E.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),o.current.apply(null,h)}var g=c.current,x=p-g;if(g===0&&(r&&m(),c.current=p),s!==void 0){if(x>s)return void m()}else x=1&&i&&i())};d()}function d(){c=requestAnimationFrame(u)}}var UH={T:0,L:0,W:0,H:0,FIT:void 0},VL=function(){var e=E.useRef(!1);return E.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},$H=["className"];function HH(e){var t=e.className,n=t===void 0?"":t,r=Wg(e,$H);return wt.createElement("div",qn({className:"PhotoView__Spinner "+n},r),wt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},wt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),wt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var zH=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function VH(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=Wg(e,zH),u=VL();return t&&!r?wt.createElement(wt.Fragment,null,wt.createElement("img",qn({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(d){var f=d.target;u.current&&i({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&i({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?wt.createElement("span",{className:"PhotoView__icon"},a):wt.createElement(HH,{className:"PhotoView__icon"}))):o?wt.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var KH={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function YH(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,g=e.loadingElement,x=e.brokenElement,y=e.onPhotoTap,w=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,N=e.isActive,A=e.expose,S=$m(KH),C=S[0],R=S[1],O=E.useRef(0),F=VL(),q=C.naturalWidth,L=q===void 0?i:q,D=C.naturalHeight,T=D===void 0?o:D,M=C.width,j=M===void 0?i:M,U=C.height,I=U===void 0?o:U,K=C.loaded,W=K===void 0?!n:K,B=C.broken,ie=C.x,Q=C.y,ee=C.touched,ce=C.stopRaf,J=C.maskTouched,fe=C.rotate,te=C.scale,ge=C.CX,we=C.CY,Z=C.lastX,me=C.lastY,Ne=C.lastCX,Ie=C.lastCY,We=C.lastScale,Ce=C.touchTime,et=C.touchLength,Ge=C.pause,Xe=C.reach,xt=Ko({onScale:function(be){return gt(Zh(be))},onRotate:function(be){fe!==be&&(A({rotate:be}),R(qn({rotate:be},Uy(L,T,be))))}});function gt(be,Ve,st){te!==be&&(A({scale:be}),R(qn({scale:be},Fy(ie,Q,j,I,te,be,Ve,st),be<=1&&{x:0,y:0})))}var At=Jh(function(be,Ve,st){if(st===void 0&&(st=0),(ee||J)&&N){var sn=lE(fe,j,I),an=sn[0],Ht=sn[1];if(st===0&&O.current===0){var zt=Math.abs(be-ge)<=20,Bt=Math.abs(Ve-we)<=20;if(zt&&Bt)return void R({lastCX:be,lastCY:Ve});O.current=zt?Ve>we?3:2:1}var qt,vn=be-Ne,Xt=Ve-Ie;if(st===0){var Ln=Da(vn+Z,te,an,innerWidth)[0],Mn=Da(Xt+me,te,Ht,innerHeight);qt=function(_e,ve,ye,nt){return ve&&_e===1||nt==="x"?"x":ye&&_e>1||nt==="y"?"y":void 0}(O.current,Ln,Mn[0],Xe),qt!==void 0&&b(qt,be,Ve,te)}if(qt==="x"||J)return void R({reach:"x"});var ue=Zh(te+(st-et)/100/2*te,L/j,.2);A({scale:ue}),R(qn({touchLength:st,reach:qt,scale:ue},Fy(ie,Q,j,I,te,ue,be,Ve,vn,Xt)))}},{maxWait:8});function ut(be){return!ce&&!ee&&(F.current&&R(qn({},be,{pause:u})),F.current)}var X,ne,he,Te,He,qe,Ut,Ye,De=(He=function(be){return ut({x:be})},qe=function(be){return ut({y:be})},Ut=function(be){return F.current&&(A({scale:be}),R({scale:be})),!ee&&F.current},Ye=Ko({X:function(be){return He(be)},Y:function(be){return qe(be)},S:function(be){return Ut(be)}}),function(be,Ve,st,sn,an,Ht,zt,Bt,qt,vn,Xt){var Ln=lE(vn,an,Ht),Mn=Ln[0],ue=Ln[1],_e=Da(be,Bt,Mn,innerWidth),ve=_e[0],ye=_e[1],nt=Da(Ve,Bt,ue,innerHeight),Qe=nt[0],ct=nt[1],ot=Date.now()-Xt;if(ot>=200||Bt!==zt||Math.abs(qt-zt)>1){var oe=Fy(be,Ve,an,Ht,zt,Bt),Ze=oe.x,It=oe.y,it=ve?ye:Ze!==be?Ze:null,kt=Qe?ct:It!==Ve?It:null;return it!==null&&Ro(be,it,Ye.X),kt!==null&&Ro(Ve,kt,Ye.Y),void(Bt!==zt&&Ro(zt,Bt,Ye.S))}var Ft=(be-st)/ot,Zn=(Ve-sn)/ot,or=Math.sqrt(Math.pow(Ft,2)+Math.pow(Zn,2)),lr=!1,dn=!1;(function(Zt,Yt){var Jt,Mt=Zt,Cn=0,fn=0,en=function(gr){Jt||(Jt=gr);var Kn=gr-Jt,bs=Math.sign(Zt),yr=-.001*bs,es=Math.sign(-Mt)*Math.pow(Mt,2)*2e-4,Es=Mt*Kn+(yr+es)*Math.pow(Kn,2)/2;Cn+=Es,Jt=gr,bs*(Mt+=(yr+es)*Kn)<=0?hn():Yt(Cn)?Vn():hn()};function Vn(){fn=requestAnimationFrame(en)}function hn(){cancelAnimationFrame(fn)}Vn()})(or,function(Zt){var Yt=be+Zt*(Ft/or),Jt=Ve+Zt*(Zn/or),Mt=Da(Yt,zt,Mn,innerWidth),Cn=Mt[0],fn=Mt[1],en=Da(Jt,zt,ue,innerHeight),Vn=en[0],hn=en[1];if(Cn&&!lr&&(lr=!0,ve?Ro(Yt,fn,Ye.X):jS(fn,Yt+(Yt-fn),Ye.X)),Vn&&!dn&&(dn=!0,Qe?Ro(Jt,hn,Ye.Y):jS(hn,Jt+(Jt-hn),Ye.Y)),lr&&dn)return!1;var gr=lr||Ye.X(fn),Kn=dn||Ye.Y(hn);return gr&&Kn})}),Be=(X=y,ne=function(be,Ve){Xe||gt(te!==1?1:Math.max(2,L/j),be,Ve)},he=E.useRef(0),Te=Jh(function(){he.current=0,X.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var be=[].slice.call(arguments);he.current+=1,Te.apply(void 0,be),he.current>=2&&(Te.cancel(),he.current=0,ne.apply(void 0,be))});function Ct(be,Ve){if(O.current=0,(ee||J)&&N){R({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var st=Zh(te,L/j);if(De(ie,Q,Z,me,j,I,te,st,We,fe,Ce),_(be,Ve),ge===be&&we===Ve){if(ee)return void Be(be,Ve);J&&w(be,Ve)}}}function un(be,Ve,st){st===void 0&&(st=0),R({touched:!0,CX:be,CY:Ve,lastCX:be,lastCY:Ve,lastX:ie,lastY:Q,lastScale:te,touchLength:st,touchTime:Date.now()})}function $t(be){R({maskTouched:!0,CX:be.clientX,CY:be.clientY,lastX:ie,lastY:Q})}jl(Qi?void 0:"mousemove",function(be){be.preventDefault(),At(be.clientX,be.clientY)}),jl(Qi?void 0:"mouseup",function(be){Ct(be.clientX,be.clientY)}),jl(Qi?"touchmove":void 0,function(be){be.preventDefault();var Ve=MS(be);At.apply(void 0,Ve)},{passive:!1}),jl(Qi?"touchend":void 0,function(be){var Ve=be.changedTouches[0];Ct(Ve.clientX,Ve.clientY)},{passive:!1}),jl("resize",Jh(function(){W&&!ee&&(R(Uy(L,T,fe)),k())},{maxWait:8})),oE(function(){N&&A(qn({scale:te,rotate:fe},xt))},[N]);var wn=function(be,Ve,st,sn,an,Ht,zt,Bt,qt,vn){var Xt=function(Ze,It,it,kt,Ft){var Zn=E.useRef(!1),or=$m({lead:!0,scale:it}),lr=or[0],dn=lr.lead,Zt=lr.scale,Yt=or[1],Jt=Jh(function(Mt){try{return Ft(!0),Yt({lead:!1,scale:Mt}),Promise.resolve()}catch(Cn){return Promise.reject(Cn)}},{wait:kt});return oE(function(){Zn.current?(Ft(!1),Yt({lead:!0}),Jt(it)):Zn.current=!0},[it]),dn?[Ze*Zt,It*Zt,it/Zt]:[Ze*it,It*it,1]}(Ht,zt,Bt,qt,vn),Ln=Xt[0],Mn=Xt[1],ue=Xt[2],_e=function(Ze,It,it,kt,Ft){var Zn=E.useState(UH),or=Zn[0],lr=Zn[1],dn=E.useState(0),Zt=dn[0],Yt=dn[1],Jt=E.useRef(),Mt=Ko({OK:function(){return Ze&&Yt(4)}});function Cn(fn){Ft(!1),Yt(fn)}return E.useEffect(function(){if(Jt.current||(Jt.current=Date.now()),it){if(function(fn,en){var Vn=fn&&fn.current;if(Vn&&Vn.nodeType===1){var hn=Vn.getBoundingClientRect();en({T:hn.top,L:hn.left,W:hn.width,H:hn.height,FIT:Vn.tagName==="IMG"?getComputedStyle(Vn).objectFit:void 0})}}(It,lr),Ze)return Date.now()-Jt.current<250?(Yt(1),requestAnimationFrame(function(){Yt(2),requestAnimationFrame(function(){return Cn(3)})}),void setTimeout(Mt.OK,kt)):void Yt(4);Cn(5)}},[Ze,it]),[Zt,or]}(be,Ve,st,qt,vn),ve=_e[0],ye=_e[1],nt=ye.W,Qe=ye.FIT,ct=innerWidth/2,ot=innerHeight/2,oe=ve<3||ve>4;return[oe?nt?ye.L:ct:sn+(ct-Ht*Bt/2),oe?nt?ye.T:ot:an+(ot-zt*Bt/2),Ln,oe&&Qe?Ln*(ye.H/nt):Mn,ve===0?ue:oe?nt/(Ht*Bt)||.01:ue,oe?Qe?1:0:1,ve,Qe]}(u,c,W,ie,Q,j,I,te,d,function(be){return R({pause:be})}),Fe=wn[4],dt=wn[6],Lt="transform "+d+"ms "+f,_t={className:p,onMouseDown:Qi?void 0:function(be){be.stopPropagation(),be.button===0&&un(be.clientX,be.clientY,0)},onTouchStart:Qi?function(be){be.stopPropagation(),un.apply(void 0,MS(be))}:void 0,onWheel:function(be){if(!Xe){var Ve=Zh(te-be.deltaY/100/2,L/j);R({stopRaf:!0}),gt(Ve,be.clientX,be.clientY)}},style:{width:wn[2]+"px",height:wn[3]+"px",opacity:wn[5],objectFit:dt===4?void 0:wn[7],transform:fe?"rotate("+fe+"deg)":void 0,transition:dt>2?Lt+", opacity "+d+"ms ease, height "+(dt<4?d/2:dt>4?d:0)+"ms "+f:void 0}};return wt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Qi&&N?$t:void 0,onTouchStart:Qi&&N?function(be){return $t(be.touches[0])}:void 0},wt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Fe+", 0, 0, "+Fe+", "+wn[0]+", "+wn[1]+")",transition:ee||Ge?void 0:Lt,willChange:N?"transform":void 0}},n?wt.createElement(VH,qn({src:n,loaded:W,broken:B},_t,{onPhotoLoad:function(be){R(qn({},be,be.loaded&&Uy(be.naturalWidth||0,be.naturalHeight||0,fe)))},loadingElement:g,brokenElement:x})):r&&r({attrs:_t,scale:Fe,rotate:fe})))}var DS={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function GH(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,g=e.toolbarRender,x=e.className,y=e.maskClassName,w=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,N=e.images,A=e.index,S=A===void 0?0:A,C=e.onIndexChange,R=e.visible,O=e.onClose,F=e.afterClose,q=e.portalContainer,L=$m(DS),D=L[0],T=L[1],M=E.useState(0),j=M[0],U=M[1],I=D.x,K=D.touched,W=D.pause,B=D.lastCX,ie=D.lastCY,Q=D.bg,ee=Q===void 0?u:Q,ce=D.lastBg,J=D.overlay,fe=D.minimal,te=D.scale,ge=D.rotate,we=D.onScale,Z=D.onRotate,me=e.hasOwnProperty("index"),Ne=me?S:j,Ie=me?C:U,We=E.useRef(Ne),Ce=N.length,et=N[Ne],Ge=typeof n=="boolean"?n:Ce>n,Xe=function(Fe,dt){var Lt=E.useReducer(function(st){return!st},!1)[1],_t=E.useRef(0),be=function(st){var sn=E.useRef(st);function an(Ht){sn.current=Ht}return E.useMemo(function(){(function(Ht){Fe?(Ht(Fe),_t.current=1):_t.current=2})(an)},[st]),[sn.current,an]}(Fe),Ve=be[1];return[be[0],_t.current,function(){Lt(),_t.current===2&&(Ve(!1),dt&&dt()),_t.current=0}]}(R,F),xt=Xe[0],gt=Xe[1],At=Xe[2];oE(function(){if(xt)return T({pause:!0,x:Ne*-(innerWidth+Tl)}),void(We.current=Ne);T(DS)},[xt]);var ut=Ko({close:function(Fe){Z&&Z(0),T({overlay:!0,lastBg:ee}),O(Fe)},changeIndex:function(Fe,dt){dt===void 0&&(dt=!1);var Lt=Ge?We.current+(Fe-Ne):Fe,_t=Ce-1,be=aE(Lt,0,_t),Ve=Ge?Lt:be,st=innerWidth+Tl;T({touched:!1,lastCX:void 0,lastCY:void 0,x:-st*Ve,pause:dt}),We.current=Ve,Ie&&Ie(Ge?Fe<0?_t:Fe>_t?0:Fe:be)}}),X=ut.close,ne=ut.changeIndex;function he(Fe){return Fe?X():T({overlay:!J})}function Te(){T({x:-(innerWidth+Tl)*Ne,lastCX:void 0,lastCY:void 0,pause:!0}),We.current=Ne}function He(Fe,dt,Lt,_t){Fe==="x"?function(be){if(B!==void 0){var Ve=be-B,st=Ve;!Ge&&(Ne===0&&Ve>0||Ne===Ce-1&&Ve<0)&&(st=Ve/2),T({touched:!0,lastCX:B,x:-(innerWidth+Tl)*We.current+st,pause:!1})}else T({touched:!0,lastCX:be,x:I,pause:!1})}(dt):Fe==="y"&&function(be,Ve){if(ie!==void 0){var st=u===null?null:aE(u,.01,u-Math.abs(be-ie)/100/4);T({touched:!0,lastCY:ie,bg:Ve===1?st:u,minimal:Ve===1})}else T({touched:!0,lastCY:be,bg:ee,minimal:!0})}(Lt,_t)}function qe(Fe,dt){var Lt=Fe-(B??Fe),_t=dt-(ie??dt),be=!1;if(Lt<-40)ne(Ne+1);else if(Lt>40)ne(Ne-1);else{var Ve=-(innerWidth+Tl)*We.current;Math.abs(_t)>100&&fe&&f&&(be=!0,X()),T({touched:!1,x:Ve,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!be||J})}}jl("keydown",function(Fe){if(R)switch(Fe.key){case"ArrowLeft":ne(Ne-1,!0);break;case"ArrowRight":ne(Ne+1,!0);break;case"Escape":X()}});var Ut=function(Fe,dt,Lt){return E.useMemo(function(){var _t=Fe.length;return Lt?Fe.concat(Fe).concat(Fe).slice(_t+dt-1,_t+dt+2):Fe.slice(Math.max(dt-1,0),Math.min(dt+2,_t+1))},[Fe,dt,Lt])}(N,Ne,Ge);if(!xt)return null;var Ye=J&&!gt,De=R?ee:ce,Be=we&&Z&&{images:N,index:Ne,visible:R,onClose:X,onIndexChange:ne,overlayVisible:Ye,overlay:et&&et.overlay,scale:te,rotate:ge,onScale:we,onRotate:Z},Ct=r?r(gt):400,un=s?s(gt):LS,$t=r?r(3):600,wn=s?s(3):LS;return wt.createElement(MH,{className:"PhotoView-Portal"+(Ye?"":" PhotoView-Slider__clean")+(R?"":" PhotoView-Slider__willClose")+(x?" "+x:""),role:"dialog",onClick:function(Fe){return Fe.stopPropagation()},container:q},R&&wt.createElement(BH,null),wt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(gt===1?" PhotoView-Slider__fadeIn":gt===2?" PhotoView-Slider__fadeOut":""),style:{background:De?"rgba(0, 0, 0, "+De+")":void 0,transitionTimingFunction:un,transitionDuration:(K?0:Ct)+"ms",animationDuration:Ct+"ms"},onAnimationEnd:At}),p&&wt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},wt.createElement("div",{className:"PhotoView-Slider__Counter"},Ne+1," / ",Ce),wt.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Be&&g(Be),wt.createElement(jH,{className:"PhotoView-Slider__toolbarIcon",onClick:X}))),Ut.map(function(Fe,dt){var Lt=Ge||Ne!==0?We.current-1+dt:Ne+dt;return wt.createElement(YH,{key:Ge?Fe.key+"/"+Fe.src+"/"+Lt:Fe.key,item:Fe,speed:Ct,easing:un,visible:R,onReachMove:He,onReachUp:qe,onPhotoTap:function(){return he(i)},onMaskTap:function(){return he(o)},wrapClassName:b,className:w,style:{left:(innerWidth+Tl)*Lt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:K||W?void 0:"transform "+$t+"ms "+wn},loadingElement:_,brokenElement:k,onPhotoResize:Te,isActive:We.current===Lt,expose:T})}),!Qi&&p&&wt.createElement(wt.Fragment,null,(Ge||Ne!==0)&&wt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ne(Ne-1,!0)}},wt.createElement(DH,null)),(Ge||Ne+1-1){var y=u.slice();return y.splice(x,1,g),void o({images:y})}o(function(w){return{images:w.images.concat(g)}})},remove:function(g){o(function(x){var y=x.images.filter(function(w){return w.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var x=u.findIndex(function(y){return y.key===g});o({visible:!0,index:x}),r&&r(!0,x,a)}}),p=Ko({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(g){o({index:g}),n&&n(g,a)}}),m=E.useMemo(function(){return qn({},a,h)},[a,h]);return wt.createElement(zL.Provider,{value:m},t,wt.createElement(GH,qn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var KL=function(e){var t,n,r=e.src,s=e.render,i=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=E.useContext(zL),h=(t=function(){return f.nextId()},(n=E.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=E.useRef(null);E.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),E.useEffect(function(){return function(){f.remove(h)}},[]);var m=Ko({render:function(x){return s&&s(x)},show:function(x,y){f.show(h),function(w,b){if(d){var _=d.props[w];_&&_(b)}}(x,y)}}),g=E.useMemo(function(){var x={};return u.forEach(function(y){x[y]=m.show.bind(null,y)}),x},[]);return E.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:i,width:a,height:o})},[r]),d?E.Children.only(E.cloneElement(d,qn({},g,{ref:p}))):null};/** + `),()=>{document.head.removeChild(d)}},[t]),l.jsx(o9,{isPresent:t,childRef:r,sizeRef:s,children:E.cloneElement(e,{ref:r})})}const c9=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const o=$g(u9),c=E.useId(),u=E.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=E.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),i?[Math.random(),u]:[n,u]);return E.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),E.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=l.jsx(l9,{isPresent:n,children:e})),l.jsx(Hg.Provider,{value:d,children:e})};function u9(){return new Map}function hO(e=!0){const t=E.useContext(Hg);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=E.useId();E.useEffect(()=>{e&&s(i)},[e]);const a=E.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const Wh=e=>e.key||"";function bN(e){const t=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&t.push(n)}),t}const bw=typeof window<"u",pO=bw?E.useLayoutEffect:E.useEffect,ni=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[o,c]=hO(a),u=E.useMemo(()=>bN(e),[e]),d=a&&!o?[]:u.map(Wh),f=E.useRef(!0),h=E.useRef(u),p=$g(()=>new Map),[m,g]=E.useState(u),[x,y]=E.useState(u);pO(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=Wh(_),N=a&&!o?!1:u===x||d.includes(k),A=()=>{if(p.has(k))p.set(k,!0);else return;let S=!0;p.forEach(C=>{C||(S=!1)}),S&&(b==null||b(),y(h.current),a&&(c==null||c()),r&&r())};return l.jsx(c9,{isPresent:N,initial:!f.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:A,children:_},k)})})},ds=e=>e;let mO=ds;const d9={useManualTiming:!1};function f9(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const qh=["read","resolveKeyframes","update","preRender","render","postRender"],h9=40;function gO(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=qh.reduce((y,w)=>(y[w]=f9(i),y),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(y-s.timestamp,h9),1),s.timestamp=y,s.isProcessing=!0,o.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:qh.reduce((y,w)=>{const b=a[w];return y[w]=(_,k=!1,N=!1)=>(n||m(),b.schedule(_,k,N)),y},{}),cancel:y=>{for(let w=0;wEN[e].some(n=>!!t[n])};function p9(e){for(const t in e)Mc[t]={...Mc[t],...e[t]}}const m9=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Mm(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m9.has(e)}let bO=e=>!Mm(e);function EO(e){e&&(bO=t=>t.startsWith("on")?!Mm(t):e(t))}try{EO(require("@emotion/is-prop-valid").default)}catch{}function g9(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(bO(s)||n===!0&&Mm(s)||!t&&!Mm(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function y9({children:e,isValidProp:t,...n}){t&&EO(t),n={...E.useContext(df),...n},n.isStatic=$g(()=>n.isStatic);const r=E.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(df.Provider,{value:r,children:e})}function b9(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const zg=E.createContext({});function ff(e){return typeof e=="string"||Array.isArray(e)}function Vg(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Ew=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],xw=["initial",...Ew];function Kg(e){return Vg(e.animate)||xw.some(t=>ff(e[t]))}function xO(e){return!!(Kg(e)||e.variants)}function E9(e,t){if(Kg(e)){const{initial:n,animate:r}=e;return{initial:n===!1||ff(n)?n:void 0,animate:ff(r)?r:void 0}}return e.inherit!==!1?t:{}}function x9(e){const{initial:t,animate:n}=E9(e,E.useContext(zg));return E.useMemo(()=>({initial:t,animate:n}),[xN(t),xN(n)])}function xN(e){return Array.isArray(e)?e.join(" "):e}const w9=Symbol.for("motionComponentSymbol");function Ql(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function v9(e,t,n){return E.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Ql(n)&&(n.current=r))},[t])}const ww=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),_9="framerAppearId",wO="data-"+ww(_9),{schedule:vw}=gO(queueMicrotask,!1),vO=E.createContext({});function k9(e,t,n,r,s){var i,a;const{visualElement:o}=E.useContext(zg),c=E.useContext(yO),u=E.useContext(Hg),d=E.useContext(df).reducedMotion,f=E.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=E.useContext(vO);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&N9(f.current,n,s,p);const m=E.useRef(!1);E.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const g=n[wO],x=E.useRef(!!g&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return pO(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),vw.render(h.render),x.current&&h.animationState&&h.animationState.animateChanges())}),E.useEffect(()=>{h&&(!x.current&&h.animationState&&h.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),x.current=!1))}),h}function N9(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:_O(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&Ql(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function _O(e){if(e)return e.options.allowProjection!==!1?e.projection:_O(e.parent)}function S9({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,a;e&&p9(e);function o(u,d){let f;const h={...E.useContext(df),...u,layoutId:T9(u)},{isStatic:p}=h,m=x9(u),g=r(u,p);if(!p&&bw){A9();const x=C9(h);f=x.MeasureLayout,m.visualElement=k9(s,g,h,t,x.ProjectionNode)}return l.jsxs(zg.Provider,{value:m,children:[f&&m.visualElement?l.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,v9(g,m.visualElement,d),g,p,m.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const c=E.forwardRef(o);return c[w9]=s,c}function T9({layoutId:e}){const t=E.useContext(yw).id;return t&&e!==void 0?t+"-"+e:e}function A9(e,t){E.useContext(yO).strict}function C9(e){const{drag:t,layout:n}=Mc;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const I9=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function _w(e){return typeof e!="string"||e.includes("-")?!1:!!(I9.indexOf(e)>-1||/[A-Z]/u.test(e))}function wN(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function kw(e,t,n,r){if(typeof t=="function"){const[s,i]=wN(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=wN(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const V1=e=>Array.isArray(e),R9=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),O9=e=>V1(e)?e[e.length-1]||0:e,vr=e=>!!(e&&e.getVelocity);function Hp(e){const t=vr(e)?e.get():e;return R9(t)?t.toValue():t}function L9({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const a={latestValues:M9(r,s,i,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const kO=e=>(t,n)=>{const r=E.useContext(zg),s=E.useContext(Hg),i=()=>L9(e,t,r,s);return n?i():$g(i)};function M9(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Hp(i[h]);let{initial:a,animate:o}=e;const c=Kg(e),u=xO(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!Vg(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),SO=NO("--"),j9=NO("var(--"),Nw=e=>j9(e)?D9.test(e.split("/*")[0].trim()):!1,D9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,TO=(e,t)=>t&&typeof e=="number"?t.transform(e):e,ha=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},hf={...lu,transform:e=>ha(0,1,e)},Xh={...lu,default:1},Vf=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ra=Vf("deg"),Li=Vf("%"),rt=Vf("px"),P9=Vf("vh"),B9=Vf("vw"),vN={...Li,parse:e=>Li.parse(e)/100,transform:e=>Li.transform(e*100)},F9={borderWidth:rt,borderTopWidth:rt,borderRightWidth:rt,borderBottomWidth:rt,borderLeftWidth:rt,borderRadius:rt,radius:rt,borderTopLeftRadius:rt,borderTopRightRadius:rt,borderBottomRightRadius:rt,borderBottomLeftRadius:rt,width:rt,maxWidth:rt,height:rt,maxHeight:rt,top:rt,right:rt,bottom:rt,left:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,backgroundPositionX:rt,backgroundPositionY:rt},U9={rotate:Ra,rotateX:Ra,rotateY:Ra,rotateZ:Ra,scale:Xh,scaleX:Xh,scaleY:Xh,scaleZ:Xh,skew:Ra,skewX:Ra,skewY:Ra,distance:rt,translateX:rt,translateY:rt,translateZ:rt,x:rt,y:rt,z:rt,perspective:rt,transformPerspective:rt,opacity:hf,originX:vN,originY:vN,originZ:rt},_N={...lu,transform:Math.round},Sw={...F9,...U9,zIndex:_N,size:rt,fillOpacity:hf,strokeOpacity:hf,numOctaves:_N},$9={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},H9=ou.length;function z9(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),AO=()=>({...Cw(),attrs:{}}),Iw=e=>typeof e=="string"&&e.toLowerCase()==="svg";function CO(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const IO=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function RO(e,t,n,r){CO(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(IO.has(s)?s:ww(s),t.attrs[s])}const jm={};function W9(e){Object.assign(jm,e)}function OO(e,{layout:t,layoutId:n}){return hl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!jm[e]||e==="opacity")}function Rw(e,t,n){var r;const{style:s}=e,i={};for(const a in s)(vr(s[a])||t.style&&vr(t.style[a])||OO(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function LO(e,t,n){const r=Rw(e,t,n);for(const s in e)if(vr(e[s])||vr(t[s])){const i=ou.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function q9(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const NN=["x","y","width","height","cx","cy","r"],X9={useVisualState:kO({scrapeMotionValuesFromProps:LO,createRenderState:AO,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const o in s)if(hl.has(o)){i=!0;break}}if(!i)return;let a=!t;if(t)for(let o=0;o{q9(n,r),cn.render(()=>{Aw(r,s,Iw(n.tagName),e.transformTemplate),RO(n,r)})})}})},Q9={useVisualState:kO({scrapeMotionValuesFromProps:Rw,createRenderState:Cw})};function MO(e,t,n){for(const r in t)!vr(t[r])&&!OO(r,n)&&(e[r]=t[r])}function Z9({transformTemplate:e},t){return E.useMemo(()=>{const n=Cw();return Tw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function J9(e,t){const n=e.style||{},r={};return MO(r,n,e),Object.assign(r,Z9(e,t)),r}function eU(e,t){const n={},r=J9(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function tU(e,t,n,r){const s=E.useMemo(()=>{const i=AO();return Aw(i,t,Iw(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};MO(i,e.style,e),s.style={...i,...s.style}}return s}function nU(e=!1){return(n,r,s,{latestValues:i},a)=>{const c=(_w(n)?tU:eU)(r,i,a,n),u=g9(r,typeof n=="string",e),d=n!==E.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=E.useMemo(()=>vr(f)?f.get():f,[f]);return E.createElement(n,{...d,children:h})}}function rU(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={..._w(r)?X9:Q9,preloadedFeatures:e,useRender:nU(s),createVisualElement:t,Component:r};return S9(a)}}function jO(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(zp===void 0&&Mi.set(hr.isProcessing||d9.useManualTiming?hr.timestamp:performance.now()),zp),set:e=>{zp=e,queueMicrotask(sU)}};function Lw(e,t){e.indexOf(t)===-1&&e.push(t)}function Mw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class jw{constructor(){this.subscriptions=[]}add(t){return Lw(this.subscriptions,t),()=>Mw(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class aU{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Mi.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Mi.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=iU(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new jw);const r=this.events[t].add(n);return t==="change"?()=>{r(),cn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Mi.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>SN)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,SN);return PO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function pf(e,t){return new aU(e,t)}function oU(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,pf(n))}function lU(e,t){const n=Yg(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=O9(i[a]);oU(e,a,o)}}function cU(e){return!!(vr(e)&&e.add)}function K1(e,t){const n=e.getValue("willChange");if(cU(n))return n.add(t)}function BO(e){return e.props[wO]}function Dw(e){let t;return()=>(t===void 0&&(t=e()),t)}const uU=Dw(()=>window.ScrollTimeline!==void 0);class dU{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(uU()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class fU extends dU{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const aa=e=>e*1e3,oa=e=>e/1e3;function Pw(e){return typeof e=="function"}function TN(e,t){e.timeline=t,e.onfinish=null}const Bw=e=>Array.isArray(e)&&typeof e[0]=="number",hU={linearEasing:void 0};function pU(e,t){const n=Dw(e);return()=>{var r;return(r=hU[t])!==null&&r!==void 0?r:n()}}const Dm=pU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),jc=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},FO=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Y1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:id([0,.65,.55,1]),circOut:id([.55,0,1,.45]),backIn:id([.31,.01,.66,-.59]),backOut:id([.33,1.53,.69,.99])};function $O(e,t){if(e)return typeof e=="function"&&Dm()?FO(e,t):Bw(e)?id(e):Array.isArray(e)?e.map(n=>$O(n,t)||Y1.easeOut):Y1[e]}const HO=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,mU=1e-7,gU=12;function yU(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=HO(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>mU&&++oyU(i,0,1,e,n);return i=>i===0||i===1?i:HO(s(i),t,r)}const zO=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,VO=e=>t=>1-e(1-t),KO=Kf(.33,1.53,.69,.99),Fw=VO(KO),YO=zO(Fw),GO=e=>(e*=2)<1?.5*Fw(e):.5*(2-Math.pow(2,-10*(e-1))),Uw=e=>1-Math.sin(Math.acos(e)),WO=VO(Uw),qO=zO(Uw),XO=e=>/^0[^.\s]+$/u.test(e);function bU(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||XO(e):!0}const Sd=e=>Math.round(e*1e5)/1e5,$w=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function EU(e){return e==null}const xU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Hw=(e,t)=>n=>!!(typeof n=="string"&&xU.test(n)&&n.startsWith(e)||t&&!EU(n)&&Object.prototype.hasOwnProperty.call(n,t)),QO=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match($w);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},wU=e=>ha(0,255,e),Ty={...lu,transform:e=>Math.round(wU(e))},Po={test:Hw("rgb","red"),parse:QO("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Ty.transform(e)+", "+Ty.transform(t)+", "+Ty.transform(n)+", "+Sd(hf.transform(r))+")"};function vU(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const G1={test:Hw("#"),parse:vU,transform:Po.transform},Zl={test:Hw("hsl","hue"),parse:QO("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Li.transform(Sd(t))+", "+Li.transform(Sd(n))+", "+Sd(hf.transform(r))+")"},xr={test:e=>Po.test(e)||G1.test(e)||Zl.test(e),parse:e=>Po.test(e)?Po.parse(e):Zl.test(e)?Zl.parse(e):G1.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Po.transform(e):Zl.transform(e)},_U=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function kU(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match($w))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(_U))===null||n===void 0?void 0:n.length)||0)>0}const ZO="number",JO="color",NU="var",SU="var(",AN="${}",TU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function mf(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(TU,c=>(xr.test(c)?(r.color.push(i),s.push(JO),n.push(xr.parse(c))):c.startsWith(SU)?(r.var.push(i),s.push(NU),n.push(c)):(r.number.push(i),s.push(ZO),n.push(parseFloat(c))),++i,AN)).split(AN);return{values:n,split:o,indexes:r,types:s}}function eL(e){return mf(e).values}function tL(e){const{split:t,types:n}=mf(e),r=t.length;return s=>{let i="";for(let a=0;atypeof e=="number"?0:e;function CU(e){const t=eL(e);return tL(e)(t.map(AU))}const io={test:kU,parse:eL,createTransformer:tL,getAnimatableNone:CU},IU=new Set(["brightness","contrast","saturate","opacity"]);function RU(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match($w)||[];if(!r)return e;const s=n.replace(r,"");let i=IU.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const OU=/\b([a-z-]*)\(.*?\)/gu,W1={...io,getAnimatableNone:e=>{const t=e.match(OU);return t?t.map(RU).join(" "):e}},LU={...Sw,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:W1,WebkitFilter:W1},zw=e=>LU[e];function nL(e,t){let n=zw(e);return n!==W1&&(n=io),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const MU=new Set(["auto","none","0"]);function jU(e,t,n){let r=0,s;for(;re===lu||e===rt,IN=(e,t)=>parseFloat(e.split(", ")[t]),RN=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return IN(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?IN(i[1],e):0}},DU=new Set(["x","y","z"]),PU=ou.filter(e=>!DU.has(e));function BU(e){const t=[];return PU.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Dc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:RN(4,13),y:RN(5,14)};Dc.translateX=Dc.x;Dc.translateY=Dc.y;const Vo=new Set;let q1=!1,X1=!1;function rL(){if(X1){const e=Array.from(Vo).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=BU(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}X1=!1,q1=!1,Vo.forEach(e=>e.complete()),Vo.clear()}function sL(){Vo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(X1=!0)})}function FU(){sL(),rL()}class Vw{constructor(t,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Vo.add(this),q1||(q1=!0,cn.read(sL),cn.resolveKeyframes(rL))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),UU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function $U(e){const t=UU.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function aL(e,t,n=1){const[r,s]=$U(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return iL(a)?parseFloat(a):a}return Nw(s)?aL(s,t,n+1):s}const oL=e=>t=>t.test(e),HU={test:e=>e==="auto",parse:e=>e},lL=[lu,rt,Li,Ra,B9,P9,HU],ON=e=>lL.find(oL(e));class cL extends Vw{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const LN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(io.test(e)||e==="0")&&!e.startsWith("url("));function zU(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Gg(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(KU),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const YU=40;class uL{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Mi.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>YU?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&FU(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Mi.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!VU(t,r,s,i))if(a)this.options.duration=0;else{c&&c(Gg(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Q1=2e4;function dL(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=Q1?1/0:t}const Sn=(e,t,n)=>e+(t-e)*n;function Ay(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function GU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;s=Ay(c,o,e+1/3),i=Ay(c,o,e),a=Ay(c,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function Pm(e,t){return n=>n>0?t:e}const Cy=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},WU=[G1,Po,Zl],qU=e=>WU.find(t=>t.test(e));function MN(e){const t=qU(e);if(!t)return!1;let n=t.parse(e);return t===Zl&&(n=GU(n)),n}const jN=(e,t)=>{const n=MN(e),r=MN(t);if(!n||!r)return Pm(e,t);const s={...n};return i=>(s.red=Cy(n.red,r.red,i),s.green=Cy(n.green,r.green,i),s.blue=Cy(n.blue,r.blue,i),s.alpha=Sn(n.alpha,r.alpha,i),Po.transform(s))},XU=(e,t)=>n=>t(e(n)),Yf=(...e)=>e.reduce(XU),Z1=new Set(["none","hidden"]);function QU(e,t){return Z1.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function ZU(e,t){return n=>Sn(e,t,n)}function Kw(e){return typeof e=="number"?ZU:typeof e=="string"?Nw(e)?Pm:xr.test(e)?jN:t$:Array.isArray(e)?fL:typeof e=="object"?xr.test(e)?jN:JU:Pm}function fL(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>Kw(i)(i,t[a]));return i=>{for(let a=0;a{for(const i in r)n[i]=r[i](s);return n}}function e$(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=io.createTransformer(t),r=mf(e),s=mf(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Z1.has(e)&&!s.values.length||Z1.has(t)&&!r.values.length?QU(e,t):Yf(fL(e$(r,s),s.values),n):Pm(e,t)};function hL(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Sn(e,t,n):Kw(e)(e,t)}const n$=5;function pL(e,t,n){const r=Math.max(t-n$,0);return PO(n-e(r),t-r)}const Rn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Iy=.001;function r$({duration:e=Rn.duration,bounce:t=Rn.bounce,velocity:n=Rn.velocity,mass:r=Rn.mass}){let s,i,a=1-t;a=ha(Rn.minDamping,Rn.maxDamping,a),e=ha(Rn.minDuration,Rn.maxDuration,oa(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=J1(u,a),m=Math.exp(-f);return Iy-h/p*m},i=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),g=J1(Math.pow(u,2),a);return(-s(u)+Iy>0?-1:1)*((h-p)*m)/g}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Iy+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=i$(s,i,o);if(e=aa(e),isNaN(c))return{stiffness:Rn.stiffness,damping:Rn.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const s$=12;function i$(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function l$(e){let t={velocity:Rn.velocity,stiffness:Rn.stiffness,damping:Rn.damping,mass:Rn.mass,isResolvedFromDuration:!1,...e};if(!DN(e,o$)&&DN(e,a$))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*ha(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:Rn.mass,stiffness:s,damping:i}}else{const n=r$(e);t={...t,...n,mass:Rn.mass},t.isResolvedFromDuration=!0}return t}function mL(e=Rn.visualDuration,t=Rn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=l$({...n,velocity:-oa(n.velocity||0)}),m=h||0,g=u/(2*Math.sqrt(c*d)),x=a-i,y=oa(Math.sqrt(c/d)),w=Math.abs(x)<5;r||(r=w?Rn.restSpeed.granular:Rn.restSpeed.default),s||(s=w?Rn.restDelta.granular:Rn.restDelta.default);let b;if(g<1){const k=J1(y,g);b=N=>{const A=Math.exp(-g*y*N);return a-A*((m+g*y*x)/k*Math.sin(k*N)+x*Math.cos(k*N))}}else if(g===1)b=k=>a-Math.exp(-y*k)*(x+(m+y*x)*k);else{const k=y*Math.sqrt(g*g-1);b=N=>{const A=Math.exp(-g*y*N),S=Math.min(k*N,300);return a-A*((m+g*y*x)*Math.sinh(S)+k*x*Math.cosh(S))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const N=b(k);if(p)o.done=k>=f;else{let A=0;g<1&&(A=k===0?aa(m):pL(b,k,N));const S=Math.abs(A)<=r,C=Math.abs(a-N)<=s;o.done=S&&C}return o.value=o.done?a:N,o},toString:()=>{const k=Math.min(dL(_),Q1),N=FO(A=>_.next(k*A).value,k,30);return k+"ms "+N}};return _}function PN({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>o!==void 0&&Sc,m=S=>o===void 0?c:c===void 0||Math.abs(o-S)-g*Math.exp(-S/r),b=S=>y+w(S),_=S=>{const C=w(S),R=b(S);h.done=Math.abs(C)<=u,h.value=h.done?y:R};let k,N;const A=S=>{p(h.value)&&(k=S,N=mL({keyframes:[h.value,m(h.value)],velocity:pL(b,S,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return A(0),{calculatedDuration:null,next:S=>{let C=!1;return!N&&k===void 0&&(C=!0,_(S),A(S)),k!==void 0&&S>=k?N.next(S-k):(!C&&_(S),h)}}}const c$=Kf(.42,0,1,1),u$=Kf(0,0,.58,1),gL=Kf(.42,0,.58,1),d$=e=>Array.isArray(e)&&typeof e[0]!="number",f$={linear:ds,easeIn:c$,easeInOut:gL,easeOut:u$,circIn:Uw,circInOut:qO,circOut:WO,backIn:Fw,backInOut:YO,backOut:KO,anticipate:GO},BN=e=>{if(Bw(e)){mO(e.length===4);const[t,n,r,s]=e;return Kf(t,n,r,s)}else if(typeof e=="string")return f$[e];return e};function h$(e,t,n){const r=[],s=n||hL,i=e.length-1;for(let a=0;at[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=h$(t,r,s),c=o.length,u=d=>{if(a&&d1)for(;fu(ha(e[0],e[i-1],d)):u}function m$(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=jc(0,t,r);e.push(Sn(n,1,s))}}function g$(e){const t=[0];return m$(t,e.length-1),t}function y$(e,t){return e.map(n=>n*t)}function b$(e,t){return e.map(()=>t||gL).splice(0,e.length-1)}function Bm({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=d$(r)?r.map(BN):BN(r),i={done:!1,value:t[0]},a=y$(n&&n.length===t.length?n:g$(t),e),o=p$(a,t,{ease:Array.isArray(s)?s:b$(t,s)});return{calculatedDuration:e,next:c=>(i.value=o(c),i.done=c>=e,i)}}const E$=e=>{const t=({timestamp:n})=>e(n);return{start:()=>cn.update(t,!0),stop:()=>so(t),now:()=>hr.isProcessing?hr.timestamp:Mi.now()}},x$={decay:PN,inertia:PN,tween:Bm,keyframes:Bm,spring:mL},w$=e=>e/100;class Yw extends uL{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||Vw,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,o,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,o=Pw(n)?n:x$[n]||Bm;let c,u;o!==Bm&&typeof t[0]!="number"&&(c=Yf(w$,hL(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});i==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=dL(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:g,onUpdate:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),w=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let b=this.currentTime,_=i;if(p){const S=Math.min(this.currentTime,d)/f;let C=Math.floor(S),R=S%1;!R&&S>=1&&(R=1),R===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(m==="reverse"?(R=1-R,g&&(R-=g/f)):m==="mirror"&&(_=a)),b=ha(0,1,R)*f}const k=w?{done:!1,value:c[0]}:_.next(b);o&&(k.value=o(k.value));let{done:N}=k;!w&&u!==null&&(N=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return A&&s!==void 0&&(k.value=Gg(c,this.options,s)),x&&x(k.value),A&&this.finish(),k}get duration(){const{resolved:t}=this;return t?oa(t.calculatedDuration):0}get time(){return oa(this.currentTime)}set time(t){t=aa(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=oa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=E$,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const v$=new Set(["opacity","clipPath","filter","transform"]);function _$(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=$O(o,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const k$=Dw(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Fm=10,N$=2e4;function S$(e){return Pw(e.type)||e.type==="spring"||!UO(e.ease)}function T$(e,t){const n=new Yw({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(a,o),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i=="string"&&Dm()&&A$(i)&&(i=yL[i]),S$(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...g}=this.options,x=T$(t,g);t=x.keyframes,t.length===1&&(t[1]=t[0]),r=x.duration,s=x.times,i=x.ease,a="keyframes"}const d=_$(o.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(TN(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(Gg(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return oa(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return oa(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=aa(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return ds;const{animation:r}=n;TN(r,t)}return ds}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new Yw({...p,keyframes:r,duration:s,type:i,ease:a,times:o,isGenerator:!0}),g=aa(this.time);u.setWithVelocity(m.sample(g-Fm).value,m.sample(g).value,Fm)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return k$()&&r&&v$.has(r)&&!c&&!u&&!s&&i!=="mirror"&&a!==0&&o!=="inertia"}}const C$={type:"spring",stiffness:500,damping:25,restSpeed:10},I$=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),R$={type:"keyframes",duration:.8},O$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},L$=(e,{keyframes:t})=>t.length>2?R$:hl.has(e)?e.startsWith("scale")?I$(t[1]):C$:O$;function M$({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Gw=(e,t,n,r={},s,i)=>a=>{const o=Ow(r,e)||{},c=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-aa(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};M$(o)||(d={...d,...L$(e,d)}),d.duration&&(d.duration=aa(d.duration)),d.repeatDelay&&(d.repeatDelay=aa(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Gg(d.keyframes,o);if(h!==void 0)return cn.update(()=>{d.onUpdate(h),d.onComplete()}),new fU([])}return!i&&FN.supports(d)?new FN(d):new Yw(d)};function j$({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function bL(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;r&&(a=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&j$(d,f))continue;const m={delay:n,...Ow(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=BO(e);if(y){const w=window.MotionHandoffAnimation(y,f,cn);w!==null&&(m.startTime=w,g=!0)}}K1(e,f),h.start(Gw(f,h,p,e.shouldReduceMotion&&DO.has(f)?{type:!1}:m,e,g));const x=h.animation;x&&u.push(x)}return o&&Promise.all(u).then(()=>{cn.update(()=>{o&&lU(e,o)})}),u}function eE(e,t,n={}){var r;const s=Yg(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(bL(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return D$(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function D$(e,t,n=0,r=0,s=1,i){const a=[],o=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(P$).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(eE(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function P$(e,t){return e.sortNodePosition(t)}function B$(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>eE(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=eE(e,t,n);else{const s=typeof t=="function"?Yg(e,t,n.custom):t;r=Promise.all(bL(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const F$=xw.length;function EL(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?EL(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>B$(e,n,r)))}function z$(e){let t=H$(e),n=UN(),r=!0;const s=c=>(u,d)=>{var f;const h=Yg(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...g}=h;u={...u,...g,...m}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=EL(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let x=0;x<$$;x++){const y=U$[x],w=n[y],b=u[y]!==void 0?u[y]:d[y],_=ff(b),k=y===c?w.isActive:null;k===!1&&(m=x);let N=b===d[y]&&b!==u[y]&&_;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),w.protectedKeys={...p},!w.isActive&&k===null||!b&&!w.prevProp||Vg(b)||typeof b=="boolean")continue;const A=V$(w.prevProp,b);let S=A||y===c&&w.isActive&&!N&&_||x>m&&_,C=!1;const R=Array.isArray(b)?b:[b];let O=R.reduce(s(y),{});k===!1&&(O={});const{prevResolvedValues:F={}}=w,q={...F,...O},L=M=>{S=!0,h.has(M)&&(C=!0,h.delete(M)),w.needsAnimating[M]=!0;const j=e.getValue(M);j&&(j.liveStyle=!1)};for(const M in q){const j=O[M],U=F[M];if(p.hasOwnProperty(M))continue;let I=!1;V1(j)&&V1(U)?I=!jO(j,U):I=j!==U,I?j!=null?L(M):h.add(M):j!==void 0&&h.has(M)?L(M):w.protectedKeys[M]=!0}w.prevProp=b,w.prevResolvedValues=O,w.isActive&&(p={...p,...O}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&A)||C)&&f.push(...R.map(M=>({animation:M,options:{type:y}})))}if(h.size){const x={};h.forEach(y=>{const w=e.getBaseTarget(y),b=e.getValue(y);b&&(b.liveStyle=!0),x[y]=w??null}),f.push({animation:x})}let g=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,g?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>n,reset:()=>{n=UN(),r=!0}}}function V$(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!jO(t,e):!1}function wo(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function UN(){return{animate:wo(!0),whileInView:wo(),whileHover:wo(),whileTap:wo(),whileDrag:wo(),whileFocus:wo(),exit:wo()}}class co{constructor(t){this.isMounted=!1,this.node=t}update(){}}class K$ extends co{constructor(t){super(t),t.animationState||(t.animationState=z$(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Vg(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Y$=0;class G$ extends co{constructor(){super(...arguments),this.id=Y$++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const W$={animation:{Feature:K$},exit:{Feature:G$}},Qs={x:!1,y:!1};function xL(){return Qs.x||Qs.y}function q$(e){return e==="x"||e==="y"?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}const Ww=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function gf(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Gf(e){return{point:{x:e.pageX,y:e.pageY}}}const X$=e=>t=>Ww(t)&&e(t,Gf(t));function Td(e,t,n,r){return gf(e,t,X$(n),r)}const $N=(e,t)=>Math.abs(e-t);function Q$(e,t){const n=$N(e.x,t.x),r=$N(e.y,t.y);return Math.sqrt(n**2+r**2)}class wL{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Oy(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=Q$(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:g}=hr;this.history.push({...m,timestamp:g});const{onStart:x,onMove:y}=this.handlers;h||(x&&x(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Ry(h,this.transformPagePoint),cn.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Oy(f.type==="pointercancel"?this.lastMoveEventInfo:Ry(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,x),m&&m(f,x)},!Ww(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=Gf(t),o=Ry(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=hr;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Oy(o,this.history)),this.removeListeners=Yf(Td(this.contextWindow,"pointermove",this.handlePointerMove),Td(this.contextWindow,"pointerup",this.handlePointerUp),Td(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),so(this.updatePoint)}}function Ry(e,t){return t?{point:t(e.point)}:e}function HN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Oy({point:e},t){return{point:e,delta:HN(e,vL(t)),offset:HN(e,Z$(t)),velocity:J$(t,.1)}}function Z$(e){return e[0]}function vL(e){return e[e.length-1]}function J$(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=vL(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>aa(t)));)n--;if(!r)return{x:0,y:0};const i=oa(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const _L=1e-4,e7=1-_L,t7=1+_L,kL=.01,n7=0-kL,r7=0+kL;function ps(e){return e.max-e.min}function s7(e,t,n){return Math.abs(e-t)<=n}function zN(e,t,n,r=.5){e.origin=r,e.originPoint=Sn(t.min,t.max,e.origin),e.scale=ps(n)/ps(t),e.translate=Sn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=e7&&e.scale<=t7||isNaN(e.scale))&&(e.scale=1),(e.translate>=n7&&e.translate<=r7||isNaN(e.translate))&&(e.translate=0)}function Ad(e,t,n,r){zN(e.x,t.x,n.x,r?r.originX:void 0),zN(e.y,t.y,n.y,r?r.originY:void 0)}function VN(e,t,n){e.min=n.min+t.min,e.max=e.min+ps(t)}function i7(e,t,n){VN(e.x,t.x,n.x),VN(e.y,t.y,n.y)}function KN(e,t,n){e.min=t.min-n.min,e.max=e.min+ps(t)}function Cd(e,t,n){KN(e.x,t.x,n.x),KN(e.y,t.y,n.y)}function a7(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Sn(n,e,r.max):Math.min(e,n)),e}function YN(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function o7(e,{top:t,left:n,bottom:r,right:s}){return{x:YN(e.x,n,s),y:YN(e.y,t,r)}}function GN(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=jc(t.min,t.max-r,e.min):r>s&&(n=jc(e.min,e.max-s,t.min)),ha(0,1,n)}function u7(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const tE=.35;function d7(e=tE){return e===!1?e=0:e===!0&&(e=tE),{x:WN(e,"left","right"),y:WN(e,"top","bottom")}}function WN(e,t,n){return{min:qN(e,t),max:qN(e,n)}}function qN(e,t){return typeof e=="number"?e:e[t]||0}const XN=()=>({translate:0,scale:1,origin:0,originPoint:0}),Jl=()=>({x:XN(),y:XN()}),QN=()=>({min:0,max:0}),jn=()=>({x:QN(),y:QN()});function Ss(e){return[e("x"),e("y")]}function NL({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function f7({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function h7(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Ly(e){return e===void 0||e===1}function nE({scale:e,scaleX:t,scaleY:n}){return!Ly(e)||!Ly(t)||!Ly(n)}function So(e){return nE(e)||SL(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function SL(e){return ZN(e.x)||ZN(e.y)}function ZN(e){return e&&e!=="0%"}function Um(e,t,n){const r=e-n,s=t*r;return n+s}function JN(e,t,n,r,s){return s!==void 0&&(e=Um(e,s,r)),Um(e,n,r)+t}function rE(e,t=0,n=1,r,s){e.min=JN(e.min,t,n,r,s),e.max=JN(e.max,t,n,r,s)}function TL(e,{x:t,y:n}){rE(e.x,t.translate,t.scale,t.originPoint),rE(e.y,n.translate,n.scale,n.originPoint)}const eS=.999999999999,tS=1.0000000000001;function p7(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let o=0;oeS&&(t.x=1),t.yeS&&(t.y=1)}function ec(e,t){e.min=e.min+t,e.max=e.max+t}function nS(e,t,n,r,s=.5){const i=Sn(e.min,e.max,s);rE(e,t,n,i,r)}function tc(e,t){nS(e.x,t.x,t.scaleX,t.scale,t.originX),nS(e.y,t.y,t.scaleY,t.scale,t.originY)}function AL(e,t){return NL(h7(e.getBoundingClientRect(),t))}function m7(e,t,n){const r=AL(e,n),{scroll:s}=t;return s&&(ec(r.x,s.offset.x),ec(r.y,s.offset.y)),r}const CL=({current:e})=>e?e.ownerDocument.defaultView:null,g7=new WeakMap;class y7{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Gf(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=q$(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ss(x=>{let y=this.getAxisMotionValue(x).get()||0;if(Li.test(y)){const{projection:w}=this.visualElement;if(w&&w.layout){const b=w.layout.layoutBox[x];b&&(y=ps(b)*(parseFloat(y)/100))}}this.originPoint[x]=y}),m&&cn.postRender(()=>m(d,f)),K1(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:x}=f;if(p&&this.currentDirection===null){this.currentDirection=b7(x),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,x),this.updateAxis("y",f.point,x),this.visualElement.render(),g&&g(d,f)},o=(d,f)=>this.stop(d,f),c=()=>Ss(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new wL(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:CL(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&cn.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Qh(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=a7(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Ql(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=o7(s.layoutBox,n):this.constraints=!1,this.elastic=d7(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Ss(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=u7(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Ql(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=m7(r,s.root,this.visualElement.getTransformPagePoint());let a=l7(s.layout.layoutBox,i);if(n){const o=n(f7(a));this.hasMutatedConstraints=!!o,o&&(a=NL(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=Ss(d=>{if(!Qh(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return K1(this.visualElement,t),r.start(Gw(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ss(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ss(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ss(n=>{const{drag:r}=this.getProps();if(!Qh(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n];i.set(t[n]-Sn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ql(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Ss(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();s[a]=c7({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ss(a=>{if(!Qh(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(Sn(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;g7.set(this.visualElement,this);const t=this.visualElement.current,n=Td(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Ql(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),cn.read(r);const a=gf(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ss(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=tE,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Qh(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function b7(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class E7 extends co{constructor(t){super(t),this.removeGroupControls=ds,this.removeListeners=ds,this.controls=new y7(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ds}unmount(){this.removeGroupControls(),this.removeListeners()}}const rS=e=>(t,n)=>{e&&cn.postRender(()=>e(t,n))};class x7 extends co{constructor(){super(...arguments),this.removePointerDownListener=ds}onPointerDown(t){this.session=new wL(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:CL(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:rS(t),onStart:rS(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&cn.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=Td(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Vp={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function sS(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Uu={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(rt.test(e))e=parseFloat(e);else return e;const n=sS(e,t.target.x),r=sS(e,t.target.y);return`${n}% ${r}%`}},w7={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=io.parse(e);if(s.length>5)return r;const i=io.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=c;const u=Sn(o,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class v7 extends E.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;W9(_7),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Vp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||cn.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),vw.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function IL(e){const[t,n]=hO(),r=E.useContext(yw);return l.jsx(v7,{...e,layoutGroup:r,switchLayoutGroup:E.useContext(vO),isPresent:t,safeToRemove:n})}const _7={borderRadius:{...Uu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Uu,borderTopRightRadius:Uu,borderBottomLeftRadius:Uu,borderBottomRightRadius:Uu,boxShadow:w7};function k7(e,t,n){const r=vr(e)?e:pf(e);return r.start(Gw("",r,t,n)),r.animation}function N7(e){return e instanceof SVGElement&&e.tagName!=="svg"}const S7=(e,t)=>e.depth-t.depth;class T7{constructor(){this.children=[],this.isDirty=!1}add(t){Lw(this.children,t),this.isDirty=!0}remove(t){Mw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(S7),this.isDirty=!1,this.children.forEach(t)}}function A7(e,t){const n=Mi.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(so(r),e(i-t))};return cn.read(r,!0),()=>so(r)}const RL=["TopLeft","TopRight","BottomLeft","BottomRight"],C7=RL.length,iS=e=>typeof e=="string"?parseFloat(e):e,aS=e=>typeof e=="number"||rt.test(e);function I7(e,t,n,r,s,i){s?(e.opacity=Sn(0,n.opacity!==void 0?n.opacity:1,R7(r)),e.opacityExit=Sn(t.opacity!==void 0?t.opacity:1,0,O7(r))):i&&(e.opacity=Sn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(jc(e,t,r))}function lS(e,t){e.min=t.min,e.max=t.max}function Ns(e,t){lS(e.x,t.x),lS(e.y,t.y)}function cS(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function uS(e,t,n,r,s){return e-=t,e=Um(e,1/n,r),s!==void 0&&(e=Um(e,1/s,r)),e}function L7(e,t=0,n=1,r=.5,s,i=e,a=e){if(Li.test(t)&&(t=parseFloat(t),t=Sn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=Sn(i.min,i.max,r);e===i&&(o-=t),e.min=uS(e.min,t,n,o,s),e.max=uS(e.max,t,n,o,s)}function dS(e,t,[n,r,s],i,a){L7(e,t[n],t[r],t[s],t.scale,i,a)}const M7=["x","scaleX","originX"],j7=["y","scaleY","originY"];function fS(e,t,n,r){dS(e.x,t,M7,n?n.x:void 0,r?r.x:void 0),dS(e.y,t,j7,n?n.y:void 0,r?r.y:void 0)}function hS(e){return e.translate===0&&e.scale===1}function LL(e){return hS(e.x)&&hS(e.y)}function pS(e,t){return e.min===t.min&&e.max===t.max}function D7(e,t){return pS(e.x,t.x)&&pS(e.y,t.y)}function mS(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ML(e,t){return mS(e.x,t.x)&&mS(e.y,t.y)}function gS(e){return ps(e.x)/ps(e.y)}function yS(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class P7{constructor(){this.members=[]}add(t){Lw(this.members,t),t.scheduleRender()}remove(t){if(Mw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function B7(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(r+=`scale(${o}, ${c})`),r||"none"}const To={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ad=typeof window<"u"&&window.MotionDebug!==void 0,My=["","X","Y","Z"],F7={visibility:"hidden"},bS=1e3;let U7=0;function jy(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function jL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=BO(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",cn,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&jL(r)}function DL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=U7++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ad&&(To.totalNodes=To.resolvedTargetDeltas=To.recalculatedProjection=0),this.nodes.forEach(z7),this.nodes.forEach(W7),this.nodes.forEach(q7),this.nodes.forEach(V7),ad&&window.MotionDebug.record(To)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=A7(h,250),Vp.hasAnimatedSinceResize&&(Vp.hasAnimatedSinceResize=!1,this.nodes.forEach(xS))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||eH,{onLayoutAnimationStart:x,onLayoutAnimationComplete:y}=d.getProps(),w=!this.targetLayout||!ML(this.targetLayout,m)||p,b=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||h&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,b);const _={...Ow(g,"layout"),onPlay:x,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||xS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,so(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(X7),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&jL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const k=_/1e3;wS(f.x,a.x,k),wS(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cd(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Z7(this.relativeTarget,this.relativeTargetOrigin,h,k),b&&D7(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=jn()),Ns(b,this.relativeTarget)),g&&(this.animationValues=d,I7(d,u,this.latestValues,k,w,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(so(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=cn.update(()=>{Vp.hasAnimatedSinceResize=!0,this.currentAnimation=k7(0,bS,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&PL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||jn();const f=ps(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=ps(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Ns(o,c),tc(o,d),Ad(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new P7),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&jy("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(ES),this.root.sharedNodes.clear()}}}function $7(e){e.updateLayout()}function H7(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=n.source!==e.layout.source;i==="size"?Ss(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ps(h);h.min=r[f].min,h.max=h.min+p}):PL(i,n.layoutBox,r)&&Ss(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ps(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=Jl();Ad(o,r,n.layoutBox);const c=Jl();a?Ad(c,e.applyTransform(s,!0),n.measuredBox):Ad(c,r,n.layoutBox);const u=!LL(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=jn();Cd(m,n.layoutBox,h.layoutBox);const g=jn();Cd(g,r,p.layoutBox),ML(m,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function z7(e){ad&&To.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function V7(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function K7(e){e.clearSnapshot()}function ES(e){e.clearMeasurements()}function Y7(e){e.isLayoutDirty=!1}function G7(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function xS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function W7(e){e.resolveTargetDelta()}function q7(e){e.calcProjection()}function X7(e){e.resetSkewAndRotation()}function Q7(e){e.removeLeadSnapshot()}function wS(e,t,n){e.translate=Sn(t.translate,0,n),e.scale=Sn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function vS(e,t,n,r){e.min=Sn(t.min,n.min,r),e.max=Sn(t.max,n.max,r)}function Z7(e,t,n,r){vS(e.x,t.x,n.x,r),vS(e.y,t.y,n.y,r)}function J7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const eH={duration:.45,ease:[.4,0,.1,1]},_S=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),kS=_S("applewebkit/")&&!_S("chrome/")?Math.round:ds;function NS(e){e.min=kS(e.min),e.max=kS(e.max)}function tH(e){NS(e.x),NS(e.y)}function PL(e,t,n){return e==="position"||e==="preserve-aspect"&&!s7(gS(t),gS(n),.2)}function nH(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const rH=DL({attachResizeListener:(e,t)=>gf(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dy={current:void 0},BL=DL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dy.current){const e=new rH({});e.mount(window),e.setOptions({layoutScroll:!0}),Dy.current=e}return Dy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),sH={pan:{Feature:x7},drag:{Feature:E7,ProjectionNode:BL,MeasureLayout:IL}};function iH(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function FL(e,t){const n=iH(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function SS(e){return t=>{t.pointerType==="touch"||xL()||e(t)}}function aH(e,t,n={}){const[r,s,i]=FL(e,n),a=SS(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=SS(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}function TS(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&cn.postRender(()=>i(t,Gf(t)))}class oH extends co{mount(){const{current:t}=this.node;t&&(this.unmount=aH(t,n=>(TS(this.node,n,"Start"),r=>TS(this.node,r,"End"))))}unmount(){}}class lH extends co{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yf(gf(this.node.current,"focus",()=>this.onFocus()),gf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const UL=(e,t)=>t?e===t?!0:UL(e,t.parentElement):!1,cH=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uH(e){return cH.has(e.tagName)||e.tabIndex!==-1}const od=new WeakSet;function AS(e){return t=>{t.key==="Enter"&&e(t)}}function Py(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const dH=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=AS(()=>{if(od.has(n))return;Py(n,"down");const s=AS(()=>{Py(n,"up")}),i=()=>Py(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function CS(e){return Ww(e)&&!xL()}function fH(e,t,n={}){const[r,s,i]=FL(e,n),a=o=>{const c=o.currentTarget;if(!CS(o)||od.has(c))return;od.add(c);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!CS(p)||!od.has(c))&&(od.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||UL(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(o=>{!uH(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",u=>dH(u,s),s)}),i}function IS(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&cn.postRender(()=>i(t,Gf(t)))}class hH extends co{mount(){const{current:t}=this.node;t&&(this.unmount=fH(t,n=>(IS(this.node,n,"Start"),(r,{success:s})=>IS(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const sE=new WeakMap,By=new WeakMap,pH=e=>{const t=sE.get(e.target);t&&t(e)},mH=e=>{e.forEach(pH)};function gH({root:e,...t}){const n=e||document;By.has(n)||By.set(n,{});const r=By.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(mH,{root:e,...t})),r[s]}function yH(e,t,n){const r=gH(t);return sE.set(e,n),r.observe(e),()=>{sE.delete(e),r.unobserve(e)}}const bH={some:0,all:1};class EH extends co{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:bH[s]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return yH(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(xH(t,n))&&this.startObserver()}unmount(){}}function xH({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const wH={inView:{Feature:EH},tap:{Feature:hH},focus:{Feature:lH},hover:{Feature:oH}},vH={layout:{ProjectionNode:BL,MeasureLayout:IL}},iE={current:null},$L={current:!1};function _H(){if($L.current=!0,!!bw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>iE.current=e.matches;e.addListener(t),t()}else iE.current=!1}const kH=[...lL,xr,io],NH=e=>kH.find(oL(e)),RS=new WeakMap;function SH(e,t,n){for(const r in t){const s=t[r],i=n[r];if(vr(s))e.addValue(r,s);else if(vr(i))e.addValue(r,pf(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,pf(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const OS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class TH{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Vw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Mi.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),$L.current||_H(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:iE.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){RS.delete(this.current),this.projection&&this.projection.unmount(),so(this.notifyUpdate),so(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=hl.has(t),s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&cn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Mc){const n=Mc[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=pf(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(iL(s)||XO(s))?s=parseFloat(s):!NH(s)&&io.test(n)&&(s=nL(t,n)),this.setBaseTarget(t,vr(s)?s.get():s)),vr(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=kw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!vr(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new jw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class HL extends TH{constructor(){super(...arguments),this.KeyframeResolver=cL}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;vr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function AH(e){return window.getComputedStyle(e)}class CH extends HL{constructor(){super(...arguments),this.type="html",this.renderInstance=CO}readValueFromInstance(t,n){if(hl.has(n)){const r=zw(n);return r&&r.default||0}else{const r=AH(t),s=(SO(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return AL(t,n)}build(t,n,r){Tw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Rw(t,n,r)}}class IH extends HL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(hl.has(n)){const r=zw(n);return r&&r.default||0}return n=IO.has(n)?n:ww(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return LO(t,n,r)}build(t,n,r){Aw(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){RO(t,n,r,s)}mount(t){this.isSVGTag=Iw(t.tagName),super.mount(t)}}const RH=(e,t)=>_w(e)?new IH(t):new CH(t,{allowProjection:e!==E.Fragment}),OH=rU({...W$,...wH,...sH,...vH},RH),Wt=b9(OH);function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?E.useEffect:E.useLayoutEffect;function jl(e,t,n){var r=E.useRef(t);r.current=t,E.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var LH=["container"];function MH(e){var t=e.container,n=t===void 0?document.body:t,r=Wg(e,LH);return Us.createPortal(wt.createElement("div",qn({},r)),n)}function jH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function DH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function PH(e){return wt.createElement("svg",qn({width:"44",height:"44",viewBox:"0 0 768 768"},e),wt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function BH(){return E.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function MS(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,a=s.clientY;return[(n+i)/2,(r+a)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Da=function(e,t,n,r){var s,i=n*t,a=(i-r)/2,o=e;return i<=r?(s=1,o=0):e>0&&a-e<=0?(s=2,o=a):e<0&&a+e<=0&&(s=3,o=-a),[s,o]};function Fy(e,t,n,r,s,i,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Da(e,i,n,innerWidth)[0],f=Da(t,i,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-i/s*(a-(h+e))-h+(r/n>=3&&n*i===innerWidth?0:d?c/2:c),y:o-i/s*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function lE(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function Uy(e,t,n){var r=lE(n,innerWidth,innerHeight),s=r[0],i=r[1],a=0,o=s,c=i,u=e/t*i,d=t/e*s;return e=i?o=u:e>=s&&ts/i?c=d:t/e>=3&&!r[2]?a=((c=d)-i)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function Jh(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,a=i===void 0?s||0:i,o=E.useRef(e);o.current=e;var c=E.useRef(0),u=E.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=E.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),o.current.apply(null,h)}var g=c.current,x=p-g;if(g===0&&(r&&m(),c.current=p),s!==void 0){if(x>s)return void m()}else x=1&&i&&i())};d()}function d(){c=requestAnimationFrame(u)}}var UH={T:0,L:0,W:0,H:0,FIT:void 0},VL=function(){var e=E.useRef(!1);return E.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},$H=["className"];function HH(e){var t=e.className,n=t===void 0?"":t,r=Wg(e,$H);return wt.createElement("div",qn({className:"PhotoView__Spinner "+n},r),wt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},wt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),wt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var zH=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function VH(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=Wg(e,zH),u=VL();return t&&!r?wt.createElement(wt.Fragment,null,wt.createElement("img",qn({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(d){var f=d.target;u.current&&i({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&i({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?wt.createElement("span",{className:"PhotoView__icon"},a):wt.createElement(HH,{className:"PhotoView__icon"}))):o?wt.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var KH={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function YH(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,g=e.loadingElement,x=e.brokenElement,y=e.onPhotoTap,w=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,N=e.isActive,A=e.expose,S=$m(KH),C=S[0],R=S[1],O=E.useRef(0),F=VL(),q=C.naturalWidth,L=q===void 0?i:q,D=C.naturalHeight,T=D===void 0?o:D,M=C.width,j=M===void 0?i:M,U=C.height,I=U===void 0?o:U,K=C.loaded,W=K===void 0?!n:K,B=C.broken,ie=C.x,Q=C.y,ee=C.touched,ce=C.stopRaf,J=C.maskTouched,fe=C.rotate,te=C.scale,ge=C.CX,we=C.CY,Z=C.lastX,me=C.lastY,Ne=C.lastCX,Ie=C.lastCY,We=C.lastScale,Ce=C.touchTime,et=C.touchLength,Ge=C.pause,Xe=C.reach,xt=Ko({onScale:function(be){return gt(Zh(be))},onRotate:function(be){fe!==be&&(A({rotate:be}),R(qn({rotate:be},Uy(L,T,be))))}});function gt(be,Ve,st){te!==be&&(A({scale:be}),R(qn({scale:be},Fy(ie,Q,j,I,te,be,Ve,st),be<=1&&{x:0,y:0})))}var At=Jh(function(be,Ve,st){if(st===void 0&&(st=0),(ee||J)&&N){var sn=lE(fe,j,I),an=sn[0],Ht=sn[1];if(st===0&&O.current===0){var zt=Math.abs(be-ge)<=20,Bt=Math.abs(Ve-we)<=20;if(zt&&Bt)return void R({lastCX:be,lastCY:Ve});O.current=zt?Ve>we?3:2:1}var qt,vn=be-Ne,Xt=Ve-Ie;if(st===0){var Ln=Da(vn+Z,te,an,innerWidth)[0],Mn=Da(Xt+me,te,Ht,innerHeight);qt=function(_e,ve,ye,nt){return ve&&_e===1||nt==="x"?"x":ye&&_e>1||nt==="y"?"y":void 0}(O.current,Ln,Mn[0],Xe),qt!==void 0&&b(qt,be,Ve,te)}if(qt==="x"||J)return void R({reach:"x"});var ue=Zh(te+(st-et)/100/2*te,L/j,.2);A({scale:ue}),R(qn({touchLength:st,reach:qt,scale:ue},Fy(ie,Q,j,I,te,ue,be,Ve,vn,Xt)))}},{maxWait:8});function ut(be){return!ce&&!ee&&(F.current&&R(qn({},be,{pause:u})),F.current)}var X,ne,he,Te,He,qe,Ut,Ye,De=(He=function(be){return ut({x:be})},qe=function(be){return ut({y:be})},Ut=function(be){return F.current&&(A({scale:be}),R({scale:be})),!ee&&F.current},Ye=Ko({X:function(be){return He(be)},Y:function(be){return qe(be)},S:function(be){return Ut(be)}}),function(be,Ve,st,sn,an,Ht,zt,Bt,qt,vn,Xt){var Ln=lE(vn,an,Ht),Mn=Ln[0],ue=Ln[1],_e=Da(be,Bt,Mn,innerWidth),ve=_e[0],ye=_e[1],nt=Da(Ve,Bt,ue,innerHeight),Qe=nt[0],ct=nt[1],ot=Date.now()-Xt;if(ot>=200||Bt!==zt||Math.abs(qt-zt)>1){var oe=Fy(be,Ve,an,Ht,zt,Bt),Ze=oe.x,It=oe.y,it=ve?ye:Ze!==be?Ze:null,kt=Qe?ct:It!==Ve?It:null;return it!==null&&Ro(be,it,Ye.X),kt!==null&&Ro(Ve,kt,Ye.Y),void(Bt!==zt&&Ro(zt,Bt,Ye.S))}var Ft=(be-st)/ot,Zn=(Ve-sn)/ot,or=Math.sqrt(Math.pow(Ft,2)+Math.pow(Zn,2)),lr=!1,dn=!1;(function(Zt,Yt){var Jt,Mt=Zt,Cn=0,fn=0,en=function(gr){Jt||(Jt=gr);var Kn=gr-Jt,bs=Math.sign(Zt),yr=-.001*bs,es=Math.sign(-Mt)*Math.pow(Mt,2)*2e-4,Es=Mt*Kn+(yr+es)*Math.pow(Kn,2)/2;Cn+=Es,Jt=gr,bs*(Mt+=(yr+es)*Kn)<=0?hn():Yt(Cn)?Vn():hn()};function Vn(){fn=requestAnimationFrame(en)}function hn(){cancelAnimationFrame(fn)}Vn()})(or,function(Zt){var Yt=be+Zt*(Ft/or),Jt=Ve+Zt*(Zn/or),Mt=Da(Yt,zt,Mn,innerWidth),Cn=Mt[0],fn=Mt[1],en=Da(Jt,zt,ue,innerHeight),Vn=en[0],hn=en[1];if(Cn&&!lr&&(lr=!0,ve?Ro(Yt,fn,Ye.X):jS(fn,Yt+(Yt-fn),Ye.X)),Vn&&!dn&&(dn=!0,Qe?Ro(Jt,hn,Ye.Y):jS(hn,Jt+(Jt-hn),Ye.Y)),lr&&dn)return!1;var gr=lr||Ye.X(fn),Kn=dn||Ye.Y(hn);return gr&&Kn})}),Be=(X=y,ne=function(be,Ve){Xe||gt(te!==1?1:Math.max(2,L/j),be,Ve)},he=E.useRef(0),Te=Jh(function(){he.current=0,X.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var be=[].slice.call(arguments);he.current+=1,Te.apply(void 0,be),he.current>=2&&(Te.cancel(),he.current=0,ne.apply(void 0,be))});function Ct(be,Ve){if(O.current=0,(ee||J)&&N){R({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var st=Zh(te,L/j);if(De(ie,Q,Z,me,j,I,te,st,We,fe,Ce),_(be,Ve),ge===be&&we===Ve){if(ee)return void Be(be,Ve);J&&w(be,Ve)}}}function un(be,Ve,st){st===void 0&&(st=0),R({touched:!0,CX:be,CY:Ve,lastCX:be,lastCY:Ve,lastX:ie,lastY:Q,lastScale:te,touchLength:st,touchTime:Date.now()})}function $t(be){R({maskTouched:!0,CX:be.clientX,CY:be.clientY,lastX:ie,lastY:Q})}jl(Qi?void 0:"mousemove",function(be){be.preventDefault(),At(be.clientX,be.clientY)}),jl(Qi?void 0:"mouseup",function(be){Ct(be.clientX,be.clientY)}),jl(Qi?"touchmove":void 0,function(be){be.preventDefault();var Ve=MS(be);At.apply(void 0,Ve)},{passive:!1}),jl(Qi?"touchend":void 0,function(be){var Ve=be.changedTouches[0];Ct(Ve.clientX,Ve.clientY)},{passive:!1}),jl("resize",Jh(function(){W&&!ee&&(R(Uy(L,T,fe)),k())},{maxWait:8})),oE(function(){N&&A(qn({scale:te,rotate:fe},xt))},[N]);var wn=function(be,Ve,st,sn,an,Ht,zt,Bt,qt,vn){var Xt=function(Ze,It,it,kt,Ft){var Zn=E.useRef(!1),or=$m({lead:!0,scale:it}),lr=or[0],dn=lr.lead,Zt=lr.scale,Yt=or[1],Jt=Jh(function(Mt){try{return Ft(!0),Yt({lead:!1,scale:Mt}),Promise.resolve()}catch(Cn){return Promise.reject(Cn)}},{wait:kt});return oE(function(){Zn.current?(Ft(!1),Yt({lead:!0}),Jt(it)):Zn.current=!0},[it]),dn?[Ze*Zt,It*Zt,it/Zt]:[Ze*it,It*it,1]}(Ht,zt,Bt,qt,vn),Ln=Xt[0],Mn=Xt[1],ue=Xt[2],_e=function(Ze,It,it,kt,Ft){var Zn=E.useState(UH),or=Zn[0],lr=Zn[1],dn=E.useState(0),Zt=dn[0],Yt=dn[1],Jt=E.useRef(),Mt=Ko({OK:function(){return Ze&&Yt(4)}});function Cn(fn){Ft(!1),Yt(fn)}return E.useEffect(function(){if(Jt.current||(Jt.current=Date.now()),it){if(function(fn,en){var Vn=fn&&fn.current;if(Vn&&Vn.nodeType===1){var hn=Vn.getBoundingClientRect();en({T:hn.top,L:hn.left,W:hn.width,H:hn.height,FIT:Vn.tagName==="IMG"?getComputedStyle(Vn).objectFit:void 0})}}(It,lr),Ze)return Date.now()-Jt.current<250?(Yt(1),requestAnimationFrame(function(){Yt(2),requestAnimationFrame(function(){return Cn(3)})}),void setTimeout(Mt.OK,kt)):void Yt(4);Cn(5)}},[Ze,it]),[Zt,or]}(be,Ve,st,qt,vn),ve=_e[0],ye=_e[1],nt=ye.W,Qe=ye.FIT,ct=innerWidth/2,ot=innerHeight/2,oe=ve<3||ve>4;return[oe?nt?ye.L:ct:sn+(ct-Ht*Bt/2),oe?nt?ye.T:ot:an+(ot-zt*Bt/2),Ln,oe&&Qe?Ln*(ye.H/nt):Mn,ve===0?ue:oe?nt/(Ht*Bt)||.01:ue,oe?Qe?1:0:1,ve,Qe]}(u,c,W,ie,Q,j,I,te,d,function(be){return R({pause:be})}),Fe=wn[4],dt=wn[6],Lt="transform "+d+"ms "+f,_t={className:p,onMouseDown:Qi?void 0:function(be){be.stopPropagation(),be.button===0&&un(be.clientX,be.clientY,0)},onTouchStart:Qi?function(be){be.stopPropagation(),un.apply(void 0,MS(be))}:void 0,onWheel:function(be){if(!Xe){var Ve=Zh(te-be.deltaY/100/2,L/j);R({stopRaf:!0}),gt(Ve,be.clientX,be.clientY)}},style:{width:wn[2]+"px",height:wn[3]+"px",opacity:wn[5],objectFit:dt===4?void 0:wn[7],transform:fe?"rotate("+fe+"deg)":void 0,transition:dt>2?Lt+", opacity "+d+"ms ease, height "+(dt<4?d/2:dt>4?d:0)+"ms "+f:void 0}};return wt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Qi&&N?$t:void 0,onTouchStart:Qi&&N?function(be){return $t(be.touches[0])}:void 0},wt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Fe+", 0, 0, "+Fe+", "+wn[0]+", "+wn[1]+")",transition:ee||Ge?void 0:Lt,willChange:N?"transform":void 0}},n?wt.createElement(VH,qn({src:n,loaded:W,broken:B},_t,{onPhotoLoad:function(be){R(qn({},be,be.loaded&&Uy(be.naturalWidth||0,be.naturalHeight||0,fe)))},loadingElement:g,brokenElement:x})):r&&r({attrs:_t,scale:Fe,rotate:fe})))}var DS={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function GH(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,g=e.toolbarRender,x=e.className,y=e.maskClassName,w=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,N=e.images,A=e.index,S=A===void 0?0:A,C=e.onIndexChange,R=e.visible,O=e.onClose,F=e.afterClose,q=e.portalContainer,L=$m(DS),D=L[0],T=L[1],M=E.useState(0),j=M[0],U=M[1],I=D.x,K=D.touched,W=D.pause,B=D.lastCX,ie=D.lastCY,Q=D.bg,ee=Q===void 0?u:Q,ce=D.lastBg,J=D.overlay,fe=D.minimal,te=D.scale,ge=D.rotate,we=D.onScale,Z=D.onRotate,me=e.hasOwnProperty("index"),Ne=me?S:j,Ie=me?C:U,We=E.useRef(Ne),Ce=N.length,et=N[Ne],Ge=typeof n=="boolean"?n:Ce>n,Xe=function(Fe,dt){var Lt=E.useReducer(function(st){return!st},!1)[1],_t=E.useRef(0),be=function(st){var sn=E.useRef(st);function an(Ht){sn.current=Ht}return E.useMemo(function(){(function(Ht){Fe?(Ht(Fe),_t.current=1):_t.current=2})(an)},[st]),[sn.current,an]}(Fe),Ve=be[1];return[be[0],_t.current,function(){Lt(),_t.current===2&&(Ve(!1),dt&&dt()),_t.current=0}]}(R,F),xt=Xe[0],gt=Xe[1],At=Xe[2];oE(function(){if(xt)return T({pause:!0,x:Ne*-(innerWidth+Tl)}),void(We.current=Ne);T(DS)},[xt]);var ut=Ko({close:function(Fe){Z&&Z(0),T({overlay:!0,lastBg:ee}),O(Fe)},changeIndex:function(Fe,dt){dt===void 0&&(dt=!1);var Lt=Ge?We.current+(Fe-Ne):Fe,_t=Ce-1,be=aE(Lt,0,_t),Ve=Ge?Lt:be,st=innerWidth+Tl;T({touched:!1,lastCX:void 0,lastCY:void 0,x:-st*Ve,pause:dt}),We.current=Ve,Ie&&Ie(Ge?Fe<0?_t:Fe>_t?0:Fe:be)}}),X=ut.close,ne=ut.changeIndex;function he(Fe){return Fe?X():T({overlay:!J})}function Te(){T({x:-(innerWidth+Tl)*Ne,lastCX:void 0,lastCY:void 0,pause:!0}),We.current=Ne}function He(Fe,dt,Lt,_t){Fe==="x"?function(be){if(B!==void 0){var Ve=be-B,st=Ve;!Ge&&(Ne===0&&Ve>0||Ne===Ce-1&&Ve<0)&&(st=Ve/2),T({touched:!0,lastCX:B,x:-(innerWidth+Tl)*We.current+st,pause:!1})}else T({touched:!0,lastCX:be,x:I,pause:!1})}(dt):Fe==="y"&&function(be,Ve){if(ie!==void 0){var st=u===null?null:aE(u,.01,u-Math.abs(be-ie)/100/4);T({touched:!0,lastCY:ie,bg:Ve===1?st:u,minimal:Ve===1})}else T({touched:!0,lastCY:be,bg:ee,minimal:!0})}(Lt,_t)}function qe(Fe,dt){var Lt=Fe-(B??Fe),_t=dt-(ie??dt),be=!1;if(Lt<-40)ne(Ne+1);else if(Lt>40)ne(Ne-1);else{var Ve=-(innerWidth+Tl)*We.current;Math.abs(_t)>100&&fe&&f&&(be=!0,X()),T({touched:!1,x:Ve,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!be||J})}}jl("keydown",function(Fe){if(R)switch(Fe.key){case"ArrowLeft":ne(Ne-1,!0);break;case"ArrowRight":ne(Ne+1,!0);break;case"Escape":X()}});var Ut=function(Fe,dt,Lt){return E.useMemo(function(){var _t=Fe.length;return Lt?Fe.concat(Fe).concat(Fe).slice(_t+dt-1,_t+dt+2):Fe.slice(Math.max(dt-1,0),Math.min(dt+2,_t+1))},[Fe,dt,Lt])}(N,Ne,Ge);if(!xt)return null;var Ye=J&&!gt,De=R?ee:ce,Be=we&&Z&&{images:N,index:Ne,visible:R,onClose:X,onIndexChange:ne,overlayVisible:Ye,overlay:et&&et.overlay,scale:te,rotate:ge,onScale:we,onRotate:Z},Ct=r?r(gt):400,un=s?s(gt):LS,$t=r?r(3):600,wn=s?s(3):LS;return wt.createElement(MH,{className:"PhotoView-Portal"+(Ye?"":" PhotoView-Slider__clean")+(R?"":" PhotoView-Slider__willClose")+(x?" "+x:""),role:"dialog",onClick:function(Fe){return Fe.stopPropagation()},container:q},R&&wt.createElement(BH,null),wt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(gt===1?" PhotoView-Slider__fadeIn":gt===2?" PhotoView-Slider__fadeOut":""),style:{background:De?"rgba(0, 0, 0, "+De+")":void 0,transitionTimingFunction:un,transitionDuration:(K?0:Ct)+"ms",animationDuration:Ct+"ms"},onAnimationEnd:At}),p&&wt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},wt.createElement("div",{className:"PhotoView-Slider__Counter"},Ne+1," / ",Ce),wt.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Be&&g(Be),wt.createElement(jH,{className:"PhotoView-Slider__toolbarIcon",onClick:X}))),Ut.map(function(Fe,dt){var Lt=Ge||Ne!==0?We.current-1+dt:Ne+dt;return wt.createElement(YH,{key:Ge?Fe.key+"/"+Fe.src+"/"+Lt:Fe.key,item:Fe,speed:Ct,easing:un,visible:R,onReachMove:He,onReachUp:qe,onPhotoTap:function(){return he(i)},onMaskTap:function(){return he(o)},wrapClassName:b,className:w,style:{left:(innerWidth+Tl)*Lt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:K||W?void 0:"transform "+$t+"ms "+wn},loadingElement:_,brokenElement:k,onPhotoResize:Te,isActive:We.current===Lt,expose:T})}),!Qi&&p&&wt.createElement(wt.Fragment,null,(Ge||Ne!==0)&&wt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ne(Ne-1,!0)}},wt.createElement(DH,null)),(Ge||Ne+1-1){var y=u.slice();return y.splice(x,1,g),void o({images:y})}o(function(w){return{images:w.images.concat(g)}})},remove:function(g){o(function(x){var y=x.images.filter(function(w){return w.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var x=u.findIndex(function(y){return y.key===g});o({visible:!0,index:x}),r&&r(!0,x,a)}}),p=Ko({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(g){o({index:g}),n&&n(g,a)}}),m=E.useMemo(function(){return qn({},a,h)},[a,h]);return wt.createElement(zL.Provider,{value:m},t,wt.createElement(GH,qn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var KL=function(e){var t,n,r=e.src,s=e.render,i=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=E.useContext(zL),h=(t=function(){return f.nextId()},(n=E.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=E.useRef(null);E.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),E.useEffect(function(){return function(){f.remove(h)}},[]);var m=Ko({render:function(x){return s&&s(x)},show:function(x,y){f.show(h),function(w,b){if(d){var _=d.props[w];_&&_(b)}}(x,y)}}),g=E.useMemo(function(){var x={};return u.forEach(function(y){x[y]=m.show.bind(null,y)}),x},[]);return E.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:i,width:a,height:o})},[r]),d?E.Children.only(E.cloneElement(d,qn({},g,{ref:p}))):null};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -91,7 +91,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cd=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Id=je("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -436,7 +436,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gf=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const yf=je("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -501,52 +501,52 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zr=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),FS="veadk_auth_qs";let Uu=null;function Kz(){if(Uu!==null)return Uu;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(FS,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),Uu=e):Uu=sessionStorage.getItem(FS)??"",Uu}function ji(e){const t=Kz();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const lu=3e4,Qg=12e4,cM=1e4;function ci(e,t=lu){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const Hm="veadk_local_user",zm="veadk_local_user_tab",Yz=/^[A-Za-z0-9]{1,16}$/;function uM(){try{const e=sessionStorage.getItem(zm);if(e)return e;const t=localStorage.getItem(Hm);return t&&sessionStorage.setItem(zm,t),t}catch{try{return localStorage.getItem(Hm)}catch{return null}}}function US(e){try{sessionStorage.setItem(zm,e)}catch{}try{localStorage.setItem(Hm,e)}catch{}}function Gz(){try{sessionStorage.removeItem(zm)}catch{}try{localStorage.removeItem(Hm)}catch{}}function Zg(e){const t=new Headers(e),n=uM();return n&&t.set("X-VeADK-Local-User",n),t}async function dM(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:ci(void 0,cM)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function Wz(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function qz(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function Xz(){const[e,t]=await Promise.all([uE(),dM()]);return e.status==="unauthenticated"&&t.length>0}function Qz(){window.location.assign("/oauth2/logout")}async function uE(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:ci(void 0,cM)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=uM();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function Zz(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function Jz(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const dE="veadk:authentication-required";let Id=null,od=null;function eV(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function tV(e){Id||(Id=new Promise(n=>{od=n}),window.dispatchEvent(new Event(dE)));const t=Id;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const s=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},i=>{e.removeEventListener("abort",s),r(i)})}):t}function nV(){return Id!==null}function rV(){od==null||od(),od=null,Id=null}async function rv(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",i=n.trim().slice(0,2e3),a=i?` + */const Zr=je("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),FS="veadk_auth_qs";let $u=null;function Kz(){if($u!==null)return $u;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(FS,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),$u=e):$u=sessionStorage.getItem(FS)??"",$u}function ji(e){const t=Kz();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const cu=3e4,Qg=12e4,cM=1e4;function ci(e,t=cu){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const Hm="veadk_local_user",zm="veadk_local_user_tab",Yz=/^[A-Za-z0-9]{1,16}$/;function uM(){try{const e=sessionStorage.getItem(zm);if(e)return e;const t=localStorage.getItem(Hm);return t&&sessionStorage.setItem(zm,t),t}catch{try{return localStorage.getItem(Hm)}catch{return null}}}function US(e){try{sessionStorage.setItem(zm,e)}catch{}try{localStorage.setItem(Hm,e)}catch{}}function Gz(){try{sessionStorage.removeItem(zm)}catch{}try{localStorage.removeItem(Hm)}catch{}}function Zg(e){const t=new Headers(e),n=uM();return n&&t.set("X-VeADK-Local-User",n),t}async function dM(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:ci(void 0,cM)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function Wz(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function qz(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function Xz(){const[e,t]=await Promise.all([uE(),dM()]);return e.status==="unauthenticated"&&t.length>0}function Qz(){window.location.assign("/oauth2/logout")}async function uE(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:ci(void 0,cM)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=uM();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function Zz(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function Jz(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const dE="veadk:authentication-required";let Rd=null,ld=null;function eV(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function tV(e){Rd||(Rd=new Promise(n=>{ld=n}),window.dispatchEvent(new Event(dE)));const t=Rd;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const s=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},i=>{e.removeEventListener("abort",s),r(i)})}):t}function nV(){return Rd!==null}function rV(){ld==null||ld(),ld=null,Rd=null}async function rv(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",i=n.trim().slice(0,2e3),a=i?` 响应:${i}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${s})${a}`)}}const sV=/\brun_sse\s*failed\s*:\s*404\b/i,$S="提示:该 404 可能是多实例部署使用 in-memory 或 SQLite 短期记忆导致的:请求落到不同实例后,会话无法找到。请改用基于数据库的持久化短期记忆存储。";function ep(e){const t=String(e);return!sV.test(t)||t.includes($S)?t:`${t} ${$S}`}async function*sv(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";try{for(;;){const{done:s,value:i}=await t.read();if(s)break;r+=n.decode(i,{stream:!0});let a=r.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const o=r.slice(0,a.index);r=r.slice(a.index+a[0].length);const c=o.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=r.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const iv="veadk.messageFeedback.v1";function av(e,t,n,r){return[e,t,n,r].join(":")}function ov(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(iv)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function iV(e,t,n){if(typeof window>"u")return;const r=ov();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(iv,JSON.stringify(r))}function fM(e){if(typeof window>"u")return;const t=av(e.runtimeId,e.appName,e.userId,e.sessionId),n=ov(),r=n[t];if(r){for(const s of e.eventIds)delete r[`veadk_feedback:${s}`];Object.keys(r).length===0?delete n[t]:n[t]=r,localStorage.setItem(iv,JSON.stringify(n))}}const Yp="",lv=new Map;function hM(e,t){lv.set(e,t)}function pM(){lv.clear()}function Qn(e){const t=lv.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function mt(e,t={},n={},r=lu){const s={...t,headers:Zg(t.headers)},i=()=>{const c={...s,signal:ci(t.signal,r)};if(n.runtimeId){const u=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(ji(`${Yp}/web/runtime-proxy/${n.runtimeId}${e}${u}`),c)}if(n.base){const u=new Headers(c.headers);return u.set("X-AgentKit-Base",n.base),n.apiKey&&u.set("X-AgentKit-Key",n.apiKey),fetch(ji(`${Yp}/agentkit-proxy${e}`),{...c,headers:u})}return fetch(ji(`${Yp}${e}`),c)},a=async c=>{if(eV(c))return!0;if(c.status!==401)return!1;try{return await Xz()}catch{return!1}};let o=await i();for(;await a(o);)await tV(t.signal),o=await i();return o}function aV(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return r?`${r}: ${s}`:s}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function En(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return aV(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function mM(){const e=await mt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Wf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class yf extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}async function oV(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Jg(e,t,n){const r=await mt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await oV(r):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new Wf;if(n!=null&&n.runtimeId&&r.status===404)throw new yf("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new yf("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await En(r,"读取 Agent 列表失败"));return r.json()}async function Vm(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!s.ok){const a=`创建会话失败 (${s.status})`,o=await En(s,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await s.json()).id}async function cv(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function Km(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},s);if(!i.ok)throw new Error(`get session failed: ${i.status}`);const a=await i.json();if(s.runtimeId){const o=av(s.runtimeId,r,t,n);a.state={...ov()[o]??{},...a.state??{}}}return a}async function gM(e){const{app:t,ep:n}=Qn(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");const r=await mt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Qg);if(!r.ok)throw new Error(await En(r,"提交反馈失败"));const s=await r.json(),i=av(n.runtimeId,t,e.userId,e.sessionId);return iV(i,e.eventId,s),s}async function yM(e){const t=new URLSearchParams({runtimeId:e.runtimeId,region:e.region??"cn-beijing",appName:e.appName,page_size:String(e.pageSize??100)}),n=await mt(`/web/evaluation/feedback-cases?${t.toString()}`);if(!n.ok)throw new Error(await En(n,"读取评测集失败"));return n.json()}async function bM(e){const t=await mt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:e.region??"cn-beijing",appName:e.appName,itemIds:e.itemIds})},{},Qg);if(!t.ok)throw new Error(await En(t,"删除评测案例失败"));return t.json()}async function fE(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!i.ok&&i.status!==404)throw new Error(`delete session failed: ${i.status}`)}async function lV(e){const t=await mt("/web/media/capabilities");if(!t.ok)throw new Error(await En(t,"media capabilities failed"));return t.json()}async function EM(e,t,n,r){const{app:s}=Qn(e),i=new FormData;i.set("app_name",s),i.set("user_id",t),i.set("session_id",n),i.set("file",r);const a=await mt("/web/media",{method:"POST",body:i},{},Qg);if(!a.ok)throw new Error(await En(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function hE(e,t,n){const{app:r}=Qn(e),s=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,i=await mt(s,{method:"DELETE"});if(!i.ok&&i.status!==404)throw new Error(await En(i,"media cleanup failed"))}function xM(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function Gp(e,t){const n=xM(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await mt(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await En(r,"media cleanup failed"))}function wM(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=xM(t);if(!n)return t;const r=`${n}/content`;return ji(`${Yp}${r}`)}async function vM(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const i=s.headers.get("content-type")??"";if(!i.includes("application/json")){const o=i.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function uv(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function dv(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function _M(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(dv(r,t,n),{},s);if(!i.ok)throw new Error(await En(i,"读取会话能力失败"));return uv(await i.json())}async function kM(e){const{ep:t}=Qn(e),n=await mt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await En(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var i;return((i=s.name)==null?void 0:i.trim())??""}).filter(Boolean)}async function cV(e){const{ep:t}=Qn(e),n=await mt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await En(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function uV(e,t,n){const{ep:r}=Qn(e),s=new URLSearchParams({region:n||"cn-beijing"}),i=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await mt(i,{},r);if(!a.ok)throw new Error(await En(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function NM(e,t,n=1,r=20){const{ep:s}=Qn(e),i=new URLSearchParams({query:t,page_number:String(n),page_size:String(r)}),a=await mt(`/harness/skills/findskill?${i.toString()}`,{},s);if(!a.ok)throw new Error(await En(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function SM(e,t,n,r,s){const{app:i,ep:a}=Qn(e),o=await mt(dv(i,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:r.kind,name:r.name,skill_source_id:r.skillSourceId,description:r.description,version:r.version,expected_revision:s})},a);if(!o.ok)throw new Error(await En(o,"添加会话能力失败"));return uv(await o.json())}async function TM(e,t,n,r,s){const{app:i,ep:a}=Qn(e),o=`${dv(i,t,n)}/${encodeURIComponent(r)}?expected_revision=${s}`,c=await mt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await En(c,"移除会话能力失败"));return uv(await c.json())}async function AM(e,t){const n=await mt(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();if(!r.draft)try{const s=await mt(`/web/agent-draft/${e}`,{},t);if(s.ok){const i=await s.json();r.draft=i.draft}}catch{}return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function fv(e){const{app:t,ep:n}=Qn(e);return AM(t,n)}async function e0(e,t){const n={runtimeId:e,region:t},s=(await Jg("","",n))[0];if(!s)throw new Error("该 Runtime 未提供可预览的 Agent。");return AM(s,n)}async function CM(e,t,n,r){const{app:s,ep:i}=Qn(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:r}),o=await mt(`/web/search?${a.toString()}`,{},i);if(!o.ok)throw new Error(await En(o,"Agent 检索失败"));return o.json()}async function IM(e,t){const{app:n}=Qn(e),r=await mt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*bf({appName:e,userId:t,sessionId:n,text:r,attachments:s=[],invocation:i,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Qn(e),f=s.flatMap(g=>g.status&&g.status!=="ready"?[]:g.uri?[{fileData:{mimeType:g.mimeType,fileUri:g.uri,displayName:g.name},partMetadata:{veadkMedia:{id:g.id,uri:g.uri,name:g.name,mimeType:g.mimeType,sizeBytes:g.sizeBytes}}}]:g.data?[{inlineData:{mimeType:g.mimeType,data:g.data,displayName:g.name}}]:[]),h=i&&(i.skills.length>0||i.targetAgent)?i:void 0,p=[...f,...a.map(g=>({functionResponse:{id:g.id,name:g.name,response:g.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const g=p[0],x=g.partMetadata;p[0]={...g,partMetadata:{...x,veadkInvocation:h}}}const m=await mt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!m.ok)throw new Error(ep(`run_sse failed: ${m.status}`));for await(const g of sv(m)){const x=g;typeof x.error=="string"&&(x.error=ep(x.error)),typeof x.errorMessage=="string"&&(x.errorMessage=ep(x.errorMessage)),typeof x.error_message=="string"&&(x.error_message=ep(x.error_message)),yield x}}const Rd=new Map;async function t0(e,t,n,r){var u,d,f;const s=r==null?void 0:r.taskId,i=s?new AbortController:void 0;s&&i&&Rd.set(s,i);const a=()=>{s&&Rd.get(s)===i&&Rd.delete(s)};let o;try{(u=r==null?void 0:r.onStage)==null||u.call(r,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),o=await mt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:i==null?void 0:i.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:s,runtimeId:r==null?void 0:r.runtimeId,description:r==null?void 0:r.description,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0),(d=r==null?void 0:r.onStage)==null||d.call(r,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!o.ok){const h=await o.text().catch(()=>"");throw a(),new Error(h||`部署失败 (${o.status})`)}let c=null;try{for await(const h of sv(o)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=r==null?void 0:r.onStage)==null||f.call(r,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,feishuChannel:c.feishuChannel}}async function RM(e){var n;const t=await mt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=Rd.get(e))==null||n.abort(),Rd.delete(e)}async function dV(e="cn-beijing"){const t=await mt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Ef={title:"VeADK Studio",logoUrl:""},$y={studio:!1,version:"",branding:Ef,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function OM(){var e,t;try{const n=await mt("/web/ui-config");if(!n.ok)return $y;const r=await n.json(),s=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Ef.logoUrl;return{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Ef.title,logoUrl:s?ji(s):""},features:{...$y.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return $y}}const LM={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function MM(){var n,r,s;const e=await mt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function jM(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",s=await mt(`/web/studio-update${r}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function DM(e){const t=await mt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Qg);if(!t.ok){let n="";try{const r=await t.json();n=typeof r.detail=="string"?r.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function yc(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await mt(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function PM(e,t="cn-beijing"){try{return await Jg("","",{runtimeId:e,region:t})}catch(n){if(n instanceof Wf||n instanceof yf)throw n;return null}}async function BM(e,t="cn-beijing"){const n=await mt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function hv(e,t="cn-beijing"){const n=await mt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await En(n,"加载 Runtime 详情失败"));return n.json()}async function pv(e){const t=await mt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await En(t,"生成项目失败"));return t.json()}const fV=19e4;async function FM(e){const t=await mt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},fV);if(!t.ok)throw new Error(await En(t,"生成 Agent 配置失败"));return rv(t,"生成 Agent 配置失败")}async function UM(e){const t=await mt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await En(t,"创建调试运行失败"));return rv(t,"创建调试运行失败")}async function $M(e,t){const n=await mt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await En(n,"创建调试会话失败"));return(await rv(n,"创建调试会话失败")).id}async function*HM({runId:e,userId:t,sessionId:n,text:r,signal:s}){const i=r.trim()?[{text:r}]:[],a=await mt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:i},streaming:!0}),signal:s},{},0);if(!a.ok)throw new Error(await En(a,"调试运行失败"));for await(const o of sv(a))yield o}async function ld(e){const t=await mt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await En(t,"清理调试运行失败"))}const hV=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Ef,DEFAULT_STUDIO_ACCESS:LM,RuntimeAccessDeniedError:Wf,RuntimeProbeError:yf,addSessionCapability:SM,cancelAgentkitDeployment:RM,clearMessageFeedbackCache:fM,clearRemoteApps:pM,componentSearch:CM,createGeneratedAgentTestRun:UM,createGeneratedAgentTestSession:$M,createSession:Vm,deleteAgentFeedbackCases:bM,deleteGeneratedAgentTestRun:ld,deleteMedia:Gp,deleteRuntime:BM,deleteSession:fE,deleteSessionMedia:hE,deployAgentkitProject:t0,fetchRemoteApps:Jg,generateAgentDraftFromRequirement:FM,generateAgentProject:pv,getAgentFeedbackCases:yM,getAgentInfo:fv,getMediaCapabilities:lV,getMyRuntimes:dV,getRuntimeAgentInfo:e0,getRuntimeDetail:hv,getRuntimes:yc,getSession:Km,getSessionCapabilities:_M,getSessionTrace:vM,getStudioAccess:MM,getStudioUpdateStatus:jM,getUiConfig:OM,listApps:mM,listSessionBuiltinTools:kM,listSessionSkillSpaces:cV,listSessionSkillsInSpace:uV,listSessions:cv,mediaContentUrl:wM,probeRuntimeApps:PM,registerRemoteApp:hM,removeSessionCapability:TM,runGeneratedAgentTestSSE:HM,runSSE:bf,searchSessionPublicSkills:NM,startStudioUpdate:DM,submitMessageFeedback:gM,uploadMedia:EM,webSearch:IM},Symbol.toStringTag,{value:"Module"})),pV="send_a2ui_json_to_client",mV="validated_a2ui_json",pE="adk_request_credential",HS="transfer_to_agent";function gV(e){var r,s,i,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.rawAuthCredential)==null?void 0:i.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function si(){return{blocks:[],liveStart:0}}const zS=e=>e.functionCall??e.function_call,mE=e=>e.functionResponse??e.function_response;function yV(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function bV(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function zM(e){const t=[];for(const[n,r]of e.entries()){const s=r.partMetadata??r.part_metadata,i=s==null?void 0:s.veadkTransport;if((i==null?void 0:i.hidden)===!0)continue;const a=s==null?void 0:s.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:bV(o.data),name:o.displayName??o.display_name});continue}const c=r.fileData??r.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function gE(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const EV=new Set(["llm","sequential","parallel","loop","a2a"]);function xV(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const s=r,i=Array.isArray(s.skills)?s.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=s.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&EV.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(i.length>0||a)return{skills:i,targetAgent:a}}}function wV(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function VS(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function tp(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function Dc(e,t){var a,o,c,u;const n=e.blocks.map(d=>({...d}));let r=e.liveStart;const s=((a=t.content)==null?void 0:a.parts)??[],i=s.some(d=>zS(d)||mE(d));if(t.partial&&!i){for(const d of s){const f=gE(d);typeof f=="string"&&f&&VS(n,d.thought?"thinking":"text",f)}return{blocks:n,liveStart:r}}n.length=r;for(const d of s){const f=zS(d),h=mE(d),p=zM([d]),m=gE(d);if(typeof m=="string"&&m)VS(n,d.thought?"thinking":"text",m);else if(p.length)tp(n),wV(n,p);else if(f)if(tp(n),f.name===HS){const g=yV(f.args)||((o=t.actions)==null?void 0:o.transferToAgent)||((c=t.actions)==null?void 0:c.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:g,done:!1})}else if(f.name===pE){const g=f.args??{},x=g.authConfig??g.auth_config??g,w=String(g.functionCallId??g.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:f.id??"",label:w,authUri:gV(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:f.name??"",args:f.args,done:!1});else if(h){if(tp(n),h.name===HS)for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(h.name===pE)for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="tool"&&!x.done&&x.name===h.name){x.done=!0,x.response=h.response;break}}if(h.name===pV){const g=((u=h.response)==null?void 0:u[mV])??[];if(g.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...g):n.push({kind:"a2ui",messages:g})}}}}return tp(n),r=n.length,{blocks:n,liveStart:r}}function vV(e,t={}){var s,i;const n=[];let r=si();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=mE(p))==null?void 0:m.name)===pE})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const g=n[p].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(gE).filter(p=>!!p).join(""),d=zM(c),f=xV(c);if(!u&&!d.length&&!f){r=si();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),r=si()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((i=u.meta)==null?void 0:i.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=si()),r=Dc(r,a),u.blocks=r.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function _V(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"新会话"}const kV=50,KS=48;function NV(e){return(e.events??[]).flatMap(t=>{var s,i;const r=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((i=t.content)==null?void 0:i.role)??"",ts:t.timestamp}]:[]})}function SV(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"未命名会话"}function TV(e,t,n){const r=Math.max(0,t-KS),s=Math.min(e.length,t+n+KS);return(r>0?"…":"")+e.slice(r,s).trim()+(s{var c;if((c=o.events)!=null&&c.length)return o;try{return await Km(t,e,o.id)}catch{return o}})),a=[];for(const o of i)for(const{text:c,role:u,ts:d}of NV(o)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:SV(o),snippet:TV(c,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,kV)}async function CV(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await IM(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:s,error:i}=n;return r?i?{results:[],note:i}:{results:s.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function IV(e,t,n,r){if(!t||!r.trim())return{results:[]};const s=await CM(t,e,r.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const i=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:i,sourceType:s.sourceType}:{type:"memory",index:o,content:a.content,sourceName:i,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function RV(e,t,n){return e==="session"?{results:await AV(n.userId,n.appId,t)}:e==="web"?CV(n.appId,t):IV(e,n.appId,n.userId,t)}function VM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function OV({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function LV({onClick:e}){return l.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"搜索",title:"搜索",children:[l.jsx(VM,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function MV(e,t,n){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),i=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:i(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&s.has("knowledge"),unavailableLabel:i("知识库")},{id:"memory",label:"长期记忆",ready:r&&s.has("memory"),unavailableLabel:i("长期记忆")}]}function Ym(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function YS(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function jV({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:s,onOpenSession:i}){var D,T;const[a,o]=E.useState("session"),[c,u]=E.useState(""),[d,f]=E.useState([]),[h,p]=E.useState(),[m,g]=E.useState(!1),[x,y]=E.useState(!1),[w,b]=E.useState(!1),_=E.useRef(0),k=E.useRef(null),N=MV(t,n,r),A=N.find(M=>M.id===a),S=a==="knowledge"?(D=n==null?void 0:n.components)==null?void 0:D.find(M=>M.source==="knowledgebase"||M.kind==="knowledgebase"):a==="memory"?(T=n==null?void 0:n.components)==null?void 0:T.find(M=>M.source==="long_term_memory"||M.kind==="memory"):void 0;E.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),y(!1),g(!1),b(!1)},[t]),E.useEffect(()=>{if(!w)return;function M(j){var U;(U=k.current)!=null&&U.contains(j.target)||b(!1)}return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[w]);async function C(M,j){var W;const U=M.trim();if(!U||!((W=N.find(B=>B.id===j))!=null&&W.ready))return;const I=++_.current;g(!0),y(!0);let K;try{K=await RV(j,U,{userId:e,appId:t})}catch(B){const ie=B instanceof Error?B.message:String(B);K={results:[],note:`搜索失败:${ie}`}}I===_.current&&(f(K.results),p(K.note),g(!1))}function R(M){_.current+=1,u(M),f([]),p(void 0),y(!1),g(!1)}function O(M){_.current+=1,o(M),b(!1),f([]),p(void 0),y(!1),g(!1)}const F=!!(A!=null&&A.ready),q=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(S==null?void 0:S.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(S==null?void 0:S.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=S!=null&&S.backend?Ym(S.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(A==null?void 0:A.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":w,onClick:()=>b(M=>!M),children:[l.jsx("span",{children:(A==null?void 0:A.label)??"搜索类型"}),L&&l.jsx("small",{children:L}),l.jsx(OV,{open:w})]}),w&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:N.map(M=>{var I,K;const j=M.id==="knowledge"?(I=n==null?void 0:n.components)==null?void 0:I.find(W=>W.source==="knowledgebase"||W.kind==="knowledgebase"):M.id==="memory"?(K=n==null?void 0:n.components)==null?void 0:K.find(W=>W.source==="long_term_memory"||W.kind==="memory"):void 0,U=j?[j.name,j.backend?Ym(j.backend):""].filter(Boolean).join(" · "):M.ready?M.description:M.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===M.id,disabled:!M.ready,onClick:()=>O(M.id),children:[l.jsx("span",{children:M.label}),U&&l.jsx("small",{children:U})]},M.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:M=>R(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),C(c,a))},placeholder:q,disabled:!F,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?l.jsx(Kt,{className:"icon spin"}):l.jsx(VM,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:F?x?m?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&x?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((M,j)=>l.jsx(DV,{result:M,agentLabel:s,onOpen:i},j)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(A==null?void 0:A.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function DV({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(iM,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${YS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(Xg,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(ev,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(GS,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Ym(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(GS,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Ym(e.sourceType)}`:"",e.ts?` · ${YS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function GS({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const mv="/assets/volcengine-DM14a-L-.svg",WS="(max-width: 860px)";function PV(){return l.jsxs("svg",{className:"icon sidebar-agent-face",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--left",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--right",d:"M15.5 10.7v2"})]})}function BV(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const FV={admin:"管理员",developer:"开发者",user:"普通用户"};function qS({role:e}){const t=FV[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function UV({version:e,onClose:t}){return E.useEffect(()=>{const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),Us.createPortal(l.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:l.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[l.jsxs("header",{className:"system-info-head",children:[l.jsx("h2",{id:"system-info-title",children:"系统信息"}),l.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:l.jsx(Zr,{className:"icon","aria-hidden":"true"})})]}),l.jsx("dl",{className:"system-info-meta",children:l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function $V({access:e,userInfo:t,version:n,onLogout:r}){const[s,i]=E.useState(!1),[a,o]=E.useState(!1),[c,u]=E.useState("");if(!t)return null;const d=Zz(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=BV(d||f||h),m=Jz(t),g=m===c?"":m;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>i(x=>!x),title:f?`${d} -${f}`:d,children:[l.jsxs("span",{className:`account-avatar${g?" has-image":""}`,style:p,children:[h,g?l.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:d}),l.jsx(qS,{role:e.role})]}),f&&f!==d&&l.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>i(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${g?" has-image":""}`,style:p,children:[h,g?l.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:d}),l.jsx(qS,{role:e.role})]}),f&&f!==d&&l.jsx("div",{className:"account-sub",children:f})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),o(!0)},children:[l.jsx(uo,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),r()},children:[l.jsx(Sz,{className:"icon"})," 退出登录"]})]})]}),a?l.jsx(UV,{version:n,onClose:()=>o(!1)}):null]})}function HV({branding:e,sessions:t,currentSessionId:n,features:r,access:s,streamingSids:i,onNewChat:a,onSearch:o,onQuickCreate:c,onSkillCenter:u,onAddAgent:d,onMyAgents:f,onPickSession:h,onDeleteSession:p,userInfo:m,version:g,onLogout:x}){const y=C=>(r==null?void 0:r[C])!==!1,[w,b]=E.useState(null),_=E.useRef(typeof window<"u"&&window.matchMedia(WS).matches),[k,N]=E.useState(_.current),A=[...t].sort((C,R)=>(R.lastUpdateTime??0)-(C.lastUpdateTime??0)),S=()=>{_.current=!1,N(C=>!C),b(null)};return E.useEffect(()=>{const C=window.matchMedia(WS),R=O=>{O.matches?N(F=>F||(_.current=!0,!0)):_.current&&(_.current=!1,N(!1))};return C.addEventListener("change",R),()=>C.removeEventListener("change",R)},[]),l.jsxs("aside",{className:`sidebar ${k?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:a,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||mv,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:S,"aria-label":k?"展开侧边栏":"收起侧边栏",title:k?"展开侧边栏":"收起侧边栏",children:k?l.jsx(Oz,{className:"icon"}):l.jsx(Rz,{className:"icon"})})]}),y("newChat")&&l.jsxs("button",{className:"new-chat new-chat--conversation",onClick:a,"aria-label":"新会话",title:"新会话",children:[l.jsx(ir,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:"new-chat new-chat--agents",onClick:f,"aria-label":"智能体",title:"智能体",children:[l.jsx(PV,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),y("search")&&l.jsx(LV,{onClick:o})]}),y("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),y("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:a,"aria-label":"新建会话",title:"新建会话",children:l.jsx(ir,{className:"icon"})})]}),l.jsxs("div",{className:"history-list",children:[A.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),A.map(C=>{const R=_V(C.events);return l.jsxs("div",{className:`history-item ${C.id===n?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>h(C.id),title:R,children:[(i==null?void 0:i.has(C.id))&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:R})]}),l.jsx("button",{className:"history-more",title:"更多",onClick:()=>b(O=>O===C.id?null:C.id),children:l.jsx(cz,{className:"icon"})}),w===C.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>b(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{b(null),p(C.id)},children:[l.jsx(js,{className:"icon"})," 删除"]})})]})]},C.id)})]})]}),l.jsx($V,{access:s,userInfo:m,version:g,onLogout:x})]})}const KM="veadk_agentkit_connections";function os(){try{const e=localStorage.getItem(KM);return e?JSON.parse(e):[]}catch{return[]}}function n0(e){try{localStorage.setItem(KM,JSON.stringify(e))}catch{}}function Ja(e,t){return`agentkit:${e}:${t}`}function YM(e){try{return new URL(e).host}catch{return e}}function cu(e){pM();for(const t of e)for(const n of t.apps)hM(Ja(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function GM(e,t,n,r,s,i){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:s,currentVersion:i},o=os(),c=o.findIndex(u=>u.runtimeId===e);return c===-1?o.push(a):o[c]=a,n0(o),cu(o),a}async function Od(e,t,n,r){let s;try{s=await PM(e,n)}catch(o){throw o instanceof Wf&&Gm(e),o}if(!s||s.length===0)throw Gm(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const i=Object.fromEntries(s.map(o=>[o,t])),a=GM(e,t,n,s,i,r);return Ja(a.id,s[0])}async function WM(e,t,n,r){const s=t.trim().replace(/\/+$/,""),i=await Jg(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||YM(s),base:s,apiKey:n.trim(),apps:i,appLabels:r&&i.length>0?{[i[0]]:r}:void 0},o=[...os().filter(c=>c.base!==s),a];return n0(o),cu(o),a}function zV(e){const t=os().filter(n=>n.id!==e);return n0(t),cu(t),t}function Gm(e){const t=os().filter(n=>n.runtimeId!==e);return n0(t),cu(t),t}function qM(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),r=t.flatMap(s=>s.apps.map(i=>{var o;const a=((o=s.appLabels)==null?void 0:o[i])??i;return{id:Ja(s.id,i),label:a,app:i,remote:!0,host:s.runtimeId?s.name:YM(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...r]}const XS=Object.freeze(Object.defineProperty({__proto__:null,addConnection:WM,addRuntimeConnection:GM,buildAgentEntries:qM,connectRuntime:Od,loadConnections:os,registerConnections:cu,remoteAppId:Ja,removeConnection:zV,removeRuntimeConnection:Gm},Symbol.toStringTag,{value:"Module"}));function Pc({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),l.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),l.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),l.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),l.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),l.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),l.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function yE({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),l.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),l.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),l.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function VV({className:e="icon"}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsxs("g",{transform:"translate(0 2)",children:[l.jsx("path",{d:"M11.6 3.5c.45 3.75 2.75 6.05 6.5 6.5-3.75.45-6.05 2.75-6.5 6.5-.45-3.75-2.75-6.05-6.5-6.5 3.75-.45 6.05-2.75 6.5-6.5Z"}),l.jsx("path",{d:"M18.7 3.8v3.4M20.4 5.5H17"})]})})}function XM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),l.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),l.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),l.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),l.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const QS=15,KV=1e4,YV=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function GV(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function QM(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function Hy(e,t=KV){return new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(i=>{clearTimeout(s),n(i)},i=>{clearTimeout(s),r(i)})})}function WV({open:e,onClose:t,variant:n="drawer",anchorTop:r=0,agentsSource:s,localApps:i,currentId:a,currentRuntime:o,runtimeScope:c,onSelect:u}){const[d,f]=E.useState([]),[h,p]=E.useState([""]),[m,g]=E.useState(0),[x,y]=E.useState(c==="mine"),[w,b]=E.useState(null),[_,k]=E.useState("cn-beijing"),[N,A]=E.useState(!1),[S,C]=E.useState(""),[R,O]=E.useState(""),[F,q]=E.useState(null),[L,D]=E.useState(new Set),[T,M]=E.useState(),[j,U]=E.useState("agent"),I=E.useRef(!1);function K(te){M(ge=>(ge==null?void 0:ge.runtimeId)===te.runtimeId?void 0:{runtimeId:te.runtimeId,name:te.name,region:te.region})}const W=E.useCallback(async te=>{if(d[te]){g(te);return}const ge=h[te];if(ge!==void 0){A(!0),C("");try{const we=await Hy(yc({nextToken:ge,pageSize:QS,region:_,scope:"all"}));f(Z=>{const me=[...Z];return me[te]=we.runtimes,me}),p(Z=>{const me=[...Z];return we.nextToken&&(me[te+1]=we.nextToken),me}),g(te)}catch(we){C(we instanceof Error?we.message:String(we))}finally{A(!1)}}},[h,d,_]),B=E.useCallback(async()=>{A(!0),C("");try{const te=[];let ge="";do{const we=await Hy(yc({scope:"mine",nextToken:ge,pageSize:100,region:_}));te.push(...we.runtimes),ge=we.nextToken}while(ge&&te.length<2e3);b(te)}catch(te){C(te instanceof Error?te.message:String(te))}finally{A(!1)}},[_]);E.useEffect(()=>{y(c==="mine"),f([]),p([""]),g(0),b(null),I.current=!1},[c]),E.useEffect(()=>{e&&s==="cloud"&&!x&&!I.current&&(I.current=!0,W(0))},[e,s,x,W]),E.useEffect(()=>{x&&w===null&&s==="cloud"&&B()},[x,w,s,B]),E.useEffect(()=>{e&&(M(void 0),U("agent"))},[e]);function ie(){D(new Set),x?(b(null),B()):(f([]),p([""]),g(0),I.current=!0,A(!0),C(""),Hy(yc({nextToken:"",pageSize:QS,region:_,scope:"all"})).then(te=>{f([te.runtimes]),p(te.nextToken?["",te.nextToken]:[""])}).catch(te=>C(te instanceof Error?te.message:String(te))).finally(()=>A(!1)))}function Q(te){te!==_&&(k(te),f([]),p([""]),g(0),b(null),D(new Set),I.current=!1)}const ee=!x&&(d[m+1]!==void 0||h[m+1]!==void 0);function ce(te){q(te.runtimeId),Od(te.runtimeId,te.name,te.region).then(ge=>{u(ge),t()}).catch(ge=>{if(ge instanceof Wf){C(ge.message);return}if(ge instanceof yf){ge.unsupported&&D(we=>new Set(we).add(te.runtimeId)),C(ge.message);return}D(we=>new Set(we).add(te.runtimeId))}).finally(()=>q(null))}if(!e)return null;const fe=(x?w??[]:d[m]??[]).filter(te=>R?te.name.toLowerCase().includes(R.toLowerCase()):!0);return l.jsxs(l.Fragment,{children:[n==="drawer"?l.jsx("div",{className:"menu-scrim",onClick:t}):null,l.jsxs("div",{className:`agentsel agentsel--${n}${T&&n==="drawer"?" has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:n==="drawer"?{top:r,height:`min(640px, calc(100dvh - ${r}px - 10px))`}:void 0,children:[l.jsxs("div",{className:"agentsel-main",children:[l.jsxs("div",{className:"agentsel-head",children:[l.jsxs("span",{className:"agentsel-title",children:[l.jsx(Pc,{})," 选择 Agent"]}),l.jsxs("div",{className:"agentsel-head-actions",children:[s==="cloud"&&l.jsx("button",{className:"agentsel-refresh",onClick:ie,title:"刷新",disabled:N,children:l.jsx(oM,{className:`icon ${N?"spin":""}`})}),l.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:l.jsx(Zr,{className:"icon"})})]})]}),s==="local"?l.jsx("div",{className:"agentsel-body",children:i.length===0?l.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):l.jsx("ul",{className:"agentsel-list",children:i.map(te=>l.jsx("li",{children:l.jsxs("button",{className:`agentsel-item ${te===a?"active":""}`,onClick:()=>{u(te),t()},children:[l.jsx(Pc,{}),l.jsx("span",{className:"agentsel-item-name",children:te})]})},te))})}):l.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[l.jsxs("div",{className:"agentsel-tools",children:[l.jsxs("div",{className:"agentsel-search",children:[l.jsx(gf,{className:"icon"}),l.jsx("input",{value:R,onChange:te=>O(te.target.value),placeholder:"搜索 Runtime 名称"})]}),l.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:YV.map(te=>l.jsx("button",{type:"button",className:_===te.value?"active":"","aria-pressed":_===te.value,onClick:()=>Q(te.value),children:te.label},te.value))}),c==="all"&&l.jsxs("label",{className:"agentsel-mine",children:[l.jsx("input",{type:"checkbox",checked:x,onChange:te=>y(te.target.checked)}),"只看我创建的"]})]}),S&&l.jsx("div",{className:"agentsel-error",children:S}),l.jsxs("div",{className:"agentsel-listwrap",children:[fe.length===0&&!N?l.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):l.jsx("ul",{className:"agentsel-list",children:fe.map(te=>{const ge=L.has(te.runtimeId),we=F===te.runtimeId,Z=(o==null?void 0:o.runtimeId)===te.runtimeId,me=(T==null?void 0:T.runtimeId)===te.runtimeId;return l.jsx("li",{children:l.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${Z?"active":""} ${me?"is-previewed":""}`,title:te.runtimeId,children:[l.jsx(XM,{}),l.jsxs("div",{className:"agentsel-item-main",children:[l.jsx("span",{className:"agentsel-item-name",title:te.name,children:te.name}),l.jsxs("div",{className:"agentsel-item-meta",children:[l.jsx("span",{className:`agentsel-status is-${ge?"bad":tK(te.status)}`,children:ge?"不支持":ZM(te.status)}),te.isMine&&l.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),l.jsxs("div",{className:"agentsel-item-actions",children:[l.jsx("button",{type:"button",className:"agentsel-connect",disabled:we||Z,onClick:()=>ce(te),children:we?"连接中…":Z?"已连接":ge?"重试":"连接"}),n==="drawer"?l.jsx("button",{type:"button",className:`agentsel-info ${me?"active":""}`,"aria-label":`查看 ${te.name} 信息`,"aria-pressed":me,title:"查看信息",onClick:()=>K(te),children:l.jsx(uo,{className:"icon"})}):null]})]})},te.runtimeId)})}),N&&l.jsxs("div",{className:"agentsel-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载中…"]})]}),l.jsxs("div",{className:"agentsel-pager",children:[l.jsx("button",{disabled:x||m===0||N,onClick:()=>void W(m-1),"aria-label":"上一页",children:l.jsx(iz,{className:"icon"})}),l.jsx("span",{className:"agentsel-pager-label",children:x?1:m+1}),l.jsx("button",{disabled:x||!ee||N,onClick:()=>void W(m+1),"aria-label":"下一页",children:l.jsx(Ms,{className:"icon"})})]})]})]}),n==="drawer"&&s==="cloud"&&T&&l.jsx(ZV,{runtime:T,tab:j,onTabChange:U})]})]})}const qV={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function XV(e){return qV[e.toLowerCase()]??e}function QV(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function ZV({runtime:e,tab:t,onTabChange:n}){return l.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[l.jsx("div",{className:"agentsel-head agentsel-preview-head",children:l.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[l.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),l.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),l.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),l.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:l.jsx(JV,{runtime:e})}),l.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:l.jsx(eK,{runtime:e})})]})}function JV({runtime:e}){const[t,n]=E.useState(null),[r,s]=E.useState(!0),[i,a]=E.useState(""),o=e.runtimeId,c=e.region;E.useEffect(()=>{let d=!0;return n(null),s(!0),a(""),e0(o,c).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(QM(h))}).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=(t==null?void 0:t.components)??[];return l.jsx("div",{className:"agentsel-detail-body",children:r?l.jsxs("div",{className:"agentsel-panel-state",children:[l.jsx(Kt,{className:"icon spin"})," 读取 Agent 信息…"]}):i?l.jsxs("div",{className:"agentsel-panel-empty",children:[l.jsx("span",{children:"暂时无法读取 Agent 信息"}),l.jsx("small",{title:i,children:i})]}):t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agentsel-identity",children:[l.jsx(Pc,{className:"agentsel-identity-icon"}),l.jsxs("div",{className:"agentsel-identity-copy",children:[l.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsx("h3",{children:"描述"}),l.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&l.jsx(ZS,{icon:l.jsx(aM,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&l.jsx(ZS,{icon:l.jsx(yE,{}),title:"工具",values:t.tools}),l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(VV,{})," 技能"]}),t.skillsPreviewSupported?t.skills.length>0?l.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>l.jsxs("div",{className:"agentsel-info-list-item",children:[l.jsx("strong",{title:d.name,children:d.name}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},d.name))}):l.jsx("div",{className:"agentsel-info-empty",children:"未配置"}):l.jsx("div",{className:"agentsel-info-empty",children:"暂不支持预览"})]}),u.length>0&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(XL,{className:"icon"})," 挂载组件"]}),l.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>l.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[l.jsxs("div",{className:"agentsel-component-head",children:[l.jsx("strong",{title:d.name,children:d.name}),l.jsxs("span",{children:[XV(d.kind),d.backend?` · ${QV(d.backend)}`:""]})]}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skillsPreviewSupported&&t.skills.length===0&&u.length===0&&l.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function ZS({icon:e,title:t,values:n}){return l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[e,t]}),l.jsx("div",{className:"agentsel-chips",children:n.map((r,s)=>l.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${s}`))})]})}function eK({runtime:e}){const[t,n]=E.useState(null),[r,s]=E.useState(!0),[i,a]=E.useState(""),o=e.runtimeId,c=e.region;E.useEffect(()=>{let d=!0;return s(!0),a(""),n(null),hv(o,c).then(f=>d&&n(f)).catch(f=>d&&a(QM(f instanceof Error?f.message:String(f)))).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",ZM(t.status)]),t.region&&u.push(["区域",GV(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return l.jsxs("div",{className:"agentsel-detail-body",children:[l.jsxs("div",{className:"agentsel-runtime-identity",children:[l.jsx(XM,{}),l.jsxs("div",{children:[l.jsx("strong",{title:e.name,children:e.name}),l.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?l.jsxs("div",{className:"agentsel-apps-note",children:[l.jsx(Kt,{className:"icon spin"})," 读取详情…"]}):i?l.jsx("div",{className:"agentsel-error",children:i}):t?l.jsxs(l.Fragment,{children:[l.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>l.jsxs("div",{className:"agentsel-kv-row",children:[l.jsx("dt",{children:d}),l.jsx("dd",{children:f})]},d))}),t.envs.length>0&&l.jsxs("div",{className:"agentsel-envs",children:[l.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>l.jsxs("div",{className:"agentsel-env",children:[l.jsx("span",{className:"agentsel-env-k",children:d.key}),l.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function tK(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const nK={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function ZM(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return nK[t]??(e||"-")}function rK({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o,title:c,titleLeading:u,crumbs:d,rightContent:f}){return l.jsxs("div",{className:"navbar",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx("div",{className:"navbar-default",children:d&&d.length>0?l.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:d.map((h,p)=>l.jsxs(E.Fragment,{children:[p>0&&l.jsx(Ms,{className:"crumb-sep"}),h.onClick?l.jsx("button",{className:"crumb crumb-link",onClick:h.onClick,children:h.label}):l.jsx("span",{className:"crumb crumb-current",children:h.label})]},p))}):c?l.jsxs("div",{className:"navbar-title-group",children:[u,l.jsx("div",{className:"navbar-title",title:c,children:c})]}):l.jsxs("div",{className:"navbar-title-group",children:[u,l.jsx(sK,{appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o})]})}),l.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),l.jsxs("div",{className:"navbar-right",children:[l.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),f]})]})}function sK({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o}){const[c,u]=E.useState(!1),d=h=>n?n(h):h;if(r==="cloud")return l.jsxs("div",{className:"agent-switch",children:[l.jsx("span",{className:"agent-dd-current",children:e?d(e):"选择 Agent"}),e&&o?l.jsx("button",{type:"button",className:"agent-switch-action","aria-label":"切换智能体",title:"切换智能体",onClick:o,children:l.jsx(tz,{"aria-hidden":"true"})}):null]});function f(){u(!1)}return l.jsxs("div",{className:"agent-dd",children:[l.jsxs("button",{className:"agent-dd-trigger",onClick:()=>u(h=>!h),children:[l.jsx("span",{className:"agent-dd-current",children:e?d(e):"选择 Agent"}),l.jsx(Xw,{className:`agent-dd-chev ${c?"open":""}`})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:f}),l.jsx(WV,{open:!0,variant:"navbar",agentsSource:r,localApps:s,currentId:e,currentRuntime:i,runtimeScope:a,onSelect:h=>{t(h),f()},onClose:f})]})]})}async function qf(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,lu)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function JM(){return(await qf("/web/skill-spaces?region=all")).items||[]}async function iK(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),qf(`/web/skill-spaces?${t.toString()}`)}async function e3(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function aK(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function oK(e,t,n,r,s){const i=[];n&&i.push(`version=${encodeURIComponent(n)}`),r&&i.push(`region=${encodeURIComponent(r)}`),s&&i.push(`project=${encodeURIComponent(s)}`);const a=i.length>0?`?${i.join("&")}`:"";return qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function lK(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function cK(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const uK="https://ark.cn-beijing.volces.com/api/v3/",Wp=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:uK}],Bc=[],$u=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],ui={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},t3=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:ui.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:ui.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:ui.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],rl=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Bc},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Bc},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],bE=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],EE=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Wp,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:Bc},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],Fc="viking",xE=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:Bc},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Bc,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],wE=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...Bc,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],dK={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function vE(e){const t=rl.find(n=>n.id===e||n.toolNames.includes(e));return dK[e]??(t==null?void 0:t.label)??e}function JS(e){const t=rl.find(r=>r.id===e||r.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function fK(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function hK(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),l.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function eT(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function n3({title:e,description:t,icon:n,wide:r=!1,onClose:s,children:i}){const a=E.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return E.useEffect(()=>{const o=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=o}},[s]),Us.createPortal(l.jsxs("div",{className:"session-capability-dialog-layer",children:[l.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),l.jsxs("section",{className:`session-capability-dialog${r?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[l.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&l.jsx("span",{className:"session-capability-dialog-mark",children:n}),l.jsxs("div",{children:[l.jsx("h2",{id:a.current,children:e}),l.jsx("p",{children:t})]}),l.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:s,children:l.jsx(fK,{})})]}),i]})]}),document.body)}function qp({value:e,placeholder:t,label:n,onChange:r,autoFocus:s=!1}){return l.jsxs("label",{className:"session-capability-search",children:[l.jsx(hK,{}),l.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:i=>r(i.target.value)})]})}function pK({agentName:e,tools:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=E.useState(""),[c,u]=E.useState(""),d=E.useMemo(()=>new Set(n),[n]),f=E.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${vE(m)} ${m} ${JS(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&i()};return l.jsx(n3,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:l.jsx(yE,{}),onClose:i,children:l.jsxs("div",{className:"session-tool-dialog-body",children:[l.jsx(qp,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:o,autoFocus:!0}),l.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),g=c===p;return l.jsxs("article",{className:"session-tool-option",role:"listitem",children:[l.jsx("span",{className:"session-tool-option-icon",children:l.jsx(yE,{})}),l.jsxs("span",{className:"session-tool-option-copy",children:[l.jsx("strong",{children:vE(p)}),l.jsx("code",{children:p}),l.jsx("span",{children:JS(p)})]}),l.jsx("button",{type:"button",disabled:m||r||!!c,onClick:()=>void h(p),children:m?"已添加":g?"添加中…":"添加"})]},p)})})]})})}function mK({appName:e,agentName:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=E.useState("public"),[c,u]=E.useState(""),[d,f]=E.useState([]),[h,p]=E.useState(0),[m,g]=E.useState(!0),[x,y]=E.useState(""),[w,b]=E.useState([]),[_,k]=E.useState(null),[N,A]=E.useState([]),[S,C]=E.useState(""),[R,O]=E.useState(""),[F,q]=E.useState(!0),[L,D]=E.useState(!1),[T,M]=E.useState(""),[j,U]=E.useState(""),I=E.useMemo(()=>new Set(n),[n]);E.useEffect(()=>{if(a!=="public")return;let Q=!0;const ee=window.setTimeout(()=>{g(!0),y(""),NM(e,c.trim()).then(ce=>{Q&&(f(ce.items),p(ce.totalCount))}).catch(ce=>{Q&&(f([]),p(0),y(ce instanceof Error?ce.message:"搜索 Skill Hub 失败"))}).finally(()=>{Q&&g(!1)})},250);return()=>{Q=!1,window.clearTimeout(ee)}},[e,c,a]),E.useEffect(()=>{if(a!=="agentkit")return;let Q=!0;return q(!0),M(""),JM().then(ee=>{Q&&(b(ee),k(ee[0]??null))}).catch(ee=>{Q&&M(ee instanceof Error?ee.message:"读取 Skill Space 失败")}).finally(()=>{Q&&q(!1)}),()=>{Q=!1}},[a]),E.useEffect(()=>{if(a!=="agentkit")return;if(!_){A([]);return}let Q=!0;return D(!0),M(""),e3(_.id,_.region).then(ee=>{Q&&A(ee)}).catch(ee=>{Q&&M(ee instanceof Error?ee.message:"读取技能失败")}).finally(()=>{Q&&D(!1)}),()=>{Q=!1}},[_,a]);const K=E.useMemo(()=>{const Q=S.trim().toLowerCase();return Q?w.filter(ee=>`${ee.name} ${ee.id} ${ee.description}`.toLowerCase().includes(Q)):w},[S,w]),W=E.useMemo(()=>{const Q=R.trim().toLowerCase();return Q?N.filter(ee=>`${ee.skillName} ${ee.skillDescription}`.toLowerCase().includes(Q)):N},[R,N]),B=async Q=>{if(!_)return;U(Q.skillId);const ee=await s({kind:"skill",name:Q.skillName,skillSourceId:_.id,description:Q.skillDescription,version:Q.version});U(""),ee&&i()},ie=async Q=>{U(Q.slug);const ee=await s({kind:"skill",name:Q.name,skillSourceId:`findskill:${Q.slug}`,description:Q.description,version:Q.version||Q.updatedAt});U(""),ee&&i()};return l.jsx(n3,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:i,children:l.jsxs("div",{className:"session-skill-dialog-body",children:[l.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>o("public"),children:["Skill Hub",l.jsx("span",{children:"公域"})]}),l.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>o("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?l.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[l.jsxs("div",{className:"session-public-skill-head",children:[l.jsx(qp,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),l.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),l.jsx("div",{className:"session-public-skill-list",children:x?l.jsx("div",{className:"session-capability-error",children:x}):m?l.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(Q=>{const ee=I.has(Q.name),ce=j===Q.slug;return l.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:Q.name}),l.jsx("span",{children:Q.description||"暂无描述"}),l.jsxs("small",{children:[Q.sourceRepo||Q.sourceType||"FindSkill",l.jsx("span",{"aria-hidden":"true",children:" · "}),Q.downloadCount.toLocaleString()," 次下载",Q.evaluationScore>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:" · "}),Q.evaluationScore.toFixed(1)," 分"]})]})]}),l.jsx("button",{type:"button",disabled:ee||r||!!j,onClick:()=>void ie(Q),children:ee?"已添加":ce?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(eT,{}),"添加"]})})]},Q.slug)})})]}):l.jsxs("div",{className:"session-skill-browser",children:[l.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"Skill Space"}),l.jsx("span",{children:w.length})]}),l.jsx(qp,{value:S,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),l.jsx("div",{className:"session-skill-pane-list",children:F?l.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):K.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):K.map(Q=>l.jsx("button",{type:"button",className:`session-skill-space${(_==null?void 0:_.id)===Q.id?" is-active":""}`,onClick:()=>{k(Q),O("")},children:l.jsxs("span",{children:[l.jsx("strong",{children:Q.name||Q.id}),l.jsx("small",{children:Q.description||Q.id}),l.jsxs("em",{children:[Q.skillCount??0," 个技能"]})]})},`${Q.projectName??"default"}:${Q.id}`))})]}),l.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{title:_==null?void 0:_.name,children:(_==null?void 0:_.name)||"选择 Skill Space"}),l.jsx("span",{children:N.length})]}),l.jsx(qp,{value:R,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:O})]}),l.jsx("div",{className:"session-skill-pane-list",children:T?l.jsx("div",{className:"session-capability-error",children:T}):_?L?l.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):W.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):W.map(Q=>{const ee=I.has(Q.skillName),ce=j===Q.skillId;return l.jsxs("article",{className:"session-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:Q.skillName}),l.jsx("span",{children:Q.skillDescription||"暂无描述"}),l.jsxs("small",{children:["版本 ",Q.version||"—"]})]}),l.jsx("button",{type:"button",disabled:ee||r||!!j,onClick:()=>void B(Q),children:ee?"已添加":ce?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(eT,{}),"添加"]})})]},`${Q.skillId}:${Q.version}`)}):l.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function pa({as:e="span",className:t="",duration:n=4,spread:r=20,children:s,style:i,...a}){const o=Math.min(Math.max(r,5),45);return l.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...i,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:s})}const gK={llm:"LLM",sequential:"顺序",parallel:"并行",loop:"循环",a2a:"A2A"};function r3(e){return 1+e.children.reduce((t,n)=>t+r3(n),0)}function Uc(e){return e.id||e.name}function yK(e,t){const n=Uc(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function s3(e,t=!0){return{...e,id:Uc(e),name:yK(e,t),children:e.children.map(n=>s3(n,!1))}}function i3(e,t){t.set(Uc(e),e.name||Uc(e)),e.children.forEach(n=>i3(n,t))}function bK(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function EK(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function a3({node:e,activeAgent:t,seen:n,path:r}){const s=Uc(e),i=!!s&&s===t,a=!!s&&!i&&r.has(s),o=!!s&&!i&&!a&&n.has(s);return l.jsxs("div",{className:"topo-branch",children:[l.jsxs("div",{className:`topo-node topo-type-${e.type} ${i?"is-active":""} ${a?"is-onpath":""} ${o?"is-done":""}`,title:e.description||e.name,children:[l.jsx(Pc,{className:"topo-icon"}),l.jsx("span",{className:"topo-name",children:e.name||"未命名 Agent"}),l.jsx("span",{className:"topo-badge",children:gK[e.type]??"Agent"})]}),i&&e.type==="a2a"&&l.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&l.jsx("div",{className:"topo-children",children:e.children.map(c=>l.jsx(a3,{node:c,activeAgent:t,seen:n,path:r},Uc(c)))})]})}function zy({title:e,count:t}){return l.jsxs("div",{className:"topo-module-title",children:[l.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&l.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function o3({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i=[],variant:a="rail",capabilities:o=null,capabilityLoading:c=!1,capabilityMutating:u=!1,builtinTools:d=[],onAddCapability:f,onRemoveCapability:h}){const[p,m]=E.useState(null);if(n&&!t)return l.jsx("aside",{className:`topo is-loading${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:l.jsx(pa,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const g=s3(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),x=(o==null?void 0:o.tools)??bK(t.tools).map(k=>({id:`base:tool:${k}`,kind:"tool",name:k,custom:!1})),y=(o==null?void 0:o.skills)??EK(t.skills).map(k=>({id:`base:skill:${k.name}`,kind:"skill",name:k.name,description:k.description,custom:!1})),w=!!(o&&f&&h),b=new Set(i),_=new Map;return i3(g,_),l.jsxs("aside",{className:`topo${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[l.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[l.jsxs("div",{className:"topo-agent-heading",children:[l.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]}),t.description&&l.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),l.jsxs("div",{className:"topo-module-stack",children:[l.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[l.jsx(zy,{title:"工具",count:x.length}),l.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:x.length>0?l.jsx("div",{className:"topo-tool-list",children:x.map(k=>l.jsxs("div",{className:"topo-tool",title:k.name,children:[l.jsxs("span",{className:"topo-capability-title",children:[l.jsxs("span",{className:"topo-capability-copy",children:[l.jsx("span",{className:"topo-capability-name",children:vE(k.name)}),l.jsx("code",{children:k.name})]}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]},k.id))}):l.jsx("div",{className:"topo-empty",children:"未配置"})}),w&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:c||u,onClick:()=>m("tool"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加工具"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[l.jsx(zy,{title:"技能",count:t.skillsPreviewSupported?y.length:void 0}),l.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?y.length>0?l.jsx("div",{className:"topo-skill-list",children:y.map(k=>l.jsxs("div",{className:"topo-skill",title:k.description||k.name,children:[l.jsxs("div",{className:"topo-skill-title",children:[l.jsx("span",{className:"topo-skill-name",children:k.name}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]}),k.description&&l.jsx("span",{className:"topo-skill-description",children:k.description})]},`${k.name}:${k.description}`))}):l.jsx("div",{className:"topo-empty",children:"未配置"}):l.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),w&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:c||u,onClick:()=>m("skill"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加技能"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 拓扑",children:[l.jsx(zy,{title:"拓扑",count:r3(g)}),l.jsxs("div",{className:"topo-module-scroll topo-topology-scroll",role:"region","aria-label":"Agent 拓扑列表",tabIndex:0,children:[i.length>1&&l.jsx("div",{className:"topo-path","aria-label":"执行路径",children:i.map((k,N)=>l.jsx("span",{className:"topo-path-seg",children:l.jsx("span",{className:N===i.length-1?"topo-path-name is-current":"topo-path-name",children:_.get(k)??k})},`${k}-${N}`))}),l.jsx("div",{className:"topo-tree",children:l.jsx(a3,{node:g,activeAgent:r,seen:s,path:b})})]})]})]}),p==="tool"&&f&&l.jsx(pK,{agentName:t.name,tools:d,selectedNames:x.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)}),p==="skill"&&f&&l.jsx(mK,{appName:e,agentName:t.name,selectedNames:y.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)})]})}function xK(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function wK({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,onClose:h,returnFocusRef:p}){return E.useEffect(()=>{const m=document.body.style.overflow;document.body.style.overflow="hidden";const g=x=>{x.key==="Escape"&&h()};return document.addEventListener("keydown",g),()=>{var x;document.removeEventListener("keydown",g),document.body.style.overflow=m,(x=p.current)==null||x.focus()}},[h,p]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim agent-info-scrim",onClick:h}),l.jsxs("aside",{className:"drawer drawer--agent-info",role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-drawer-title",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{id:"agent-info-drawer-title",className:"drawer-title",children:"Agent 信息"}),l.jsx("div",{className:"drawer-sub",children:"能力与协作拓扑"})]}),l.jsx("button",{type:"button",className:"drawer-close",onClick:h,"aria-label":"关闭 Agent 信息",autoFocus:!0,children:l.jsx(xK,{})})]}),l.jsx("div",{className:"agent-info-drawer-body",children:t||n?l.jsx(o3,{appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,variant:"drawer"}):l.jsx("div",{className:"drawer-empty",children:"暂时无法读取 Agent 信息。"})})]})]})}function Bbe(){}function tT(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function l3(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vK=/[$_\p{ID_Start}]/u,_K=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,kK=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,NK=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SK=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c3={};function Fbe(e){return e?vK.test(String.fromCodePoint(e)):!1}function Ube(e,t){const r=(t||c3).jsx?kK:_K;return e?r.test(String.fromCodePoint(e)):!1}function nT(e,t){return(c3.jsx?SK:NK).test(e)}const TK=/[ \t\n\f\r]/g;function AK(e){return typeof e=="object"?e.type==="text"?rT(e.value):!1:rT(e)}function rT(e){return e.replace(TK,"")===""}let Xf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Xf.prototype.normal={};Xf.prototype.property={};Xf.prototype.space=void 0;function u3(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Xf(n,r,t)}function xf(e){return e.toLowerCase()}class Jr{constructor(t,n){this.attribute=n,this.property=t}}Jr.prototype.attribute="";Jr.prototype.booleanish=!1;Jr.prototype.boolean=!1;Jr.prototype.commaOrSpaceSeparated=!1;Jr.prototype.commaSeparated=!1;Jr.prototype.defined=!1;Jr.prototype.mustUseProperty=!1;Jr.prototype.number=!1;Jr.prototype.overloadedBoolean=!1;Jr.prototype.property="";Jr.prototype.spaceSeparated=!1;Jr.prototype.space=void 0;let CK=0;const bt=pl(),$n=pl(),_E=pl(),Le=pl(),tn=pl(),bc=pl(),is=pl();function pl(){return 2**++CK}const kE=Object.freeze(Object.defineProperty({__proto__:null,boolean:bt,booleanish:$n,commaOrSpaceSeparated:is,commaSeparated:bc,number:Le,overloadedBoolean:_E,spaceSeparated:tn},Symbol.toStringTag,{value:"Module"})),Vy=Object.keys(kE);class gv extends Jr{constructor(t,n,r,s){let i=-1;if(super(t,n),sT(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&MK.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(iT,DK);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!iT.test(i)){let a=i.replace(LK,jK);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=gv}return new s(r,t)}function jK(e){return"-"+e.toLowerCase()}function DK(e){return e.charAt(1).toUpperCase()}const Qf=u3([d3,IK,p3,m3,g3],"html"),fo=u3([d3,RK,p3,m3,g3],"svg");function aT(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function y3(e){return e.join(" ").trim()}var yv={},oT=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,PK=/\n/g,BK=/^\s*/,FK=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,UK=/^:\s*/,$K=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,HK=/^[;\s]*/,zK=/^\s+|\s+$/g,VK=` -`,lT="/",cT="*",Oo="",KK="comment",YK="declaration";function GK(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var g=m.match(PK);g&&(n+=g.length);var x=m.lastIndexOf(VK);r=~x?m.length-x:r+m.length}function i(){var m={line:n,column:r};return function(g){return g.position=new a(m),u(),g}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var x=g[0];return s(x),e=e.slice(x.length),g}}function u(){c(BK)}function d(m){var g;for(m=m||[];g=f();)g!==!1&&m.push(g);return m}function f(){var m=i();if(!(lT!=e.charAt(0)||cT!=e.charAt(1))){for(var g=2;Oo!=e.charAt(g)&&(cT!=e.charAt(g)||lT!=e.charAt(g+1));)++g;if(g+=2,Oo===e.charAt(g-1))return o("End of comment missing");var x=e.slice(2,g-2);return r+=2,s(x),e=e.slice(g),r+=2,m({type:KK,comment:x})}}function h(){var m=i(),g=c(FK);if(g){if(f(),!c(UK))return o("property missing ':'");var x=c($K),y=m({type:YK,property:uT(g[0].replace(oT,Oo)),value:x?uT(x[0].replace(oT,Oo)):Oo});return c(HK),y}}function p(){var m=[];d(m);for(var g;g=h();)g!==!1&&(m.push(g),d(m));return m}return u(),p()}function uT(e){return e?e.replace(zK,Oo):Oo}var WK=GK,qK=cm&&cm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yv,"__esModule",{value:!0});yv.default=QK;const XK=qK(WK);function QK(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,XK.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var s0={};Object.defineProperty(s0,"__esModule",{value:!0});s0.camelCase=void 0;var ZK=/^--[a-zA-Z0-9_-]+$/,JK=/-([a-z])/g,eY=/^[^-]+$/,tY=/^-(webkit|moz|ms|o|khtml)-/,nY=/^-(ms)-/,rY=function(e){return!e||eY.test(e)||ZK.test(e)},sY=function(e,t){return t.toUpperCase()},dT=function(e,t){return"".concat(t,"-")},iY=function(e,t){return t===void 0&&(t={}),rY(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(nY,dT):e=e.replace(tY,dT),e.replace(JK,sY))};s0.camelCase=iY;var aY=cm&&cm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},oY=aY(yv),lY=s0;function NE(e,t){var n={};return!e||typeof e!="string"||(0,oY.default)(e,function(r,s){r&&s&&(n[(0,lY.camelCase)(r,t)]=s)}),n}NE.default=NE;var cY=NE;const uY=Bf(cY),i0=b3("end"),Bi=b3("start");function b3(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function dY(e){const t=Bi(e),n=i0(e);if(t&&n)return{start:t,end:n}}function Ld(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fT(e.position):"start"in e||"end"in e?fT(e):"line"in e||"column"in e?SE(e):""}function SE(e){return hT(e&&e.line)+":"+hT(e&&e.column)}function fT(e){return SE(e&&e.start)+"-"+SE(e&&e.end)}function hT(e){return e&&typeof e=="number"?e:1}class Sr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Ld(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Sr.prototype.file="";Sr.prototype.name="";Sr.prototype.reason="";Sr.prototype.message="";Sr.prototype.stack="";Sr.prototype.column=void 0;Sr.prototype.line=void 0;Sr.prototype.ancestors=void 0;Sr.prototype.cause=void 0;Sr.prototype.fatal=void 0;Sr.prototype.place=void 0;Sr.prototype.ruleId=void 0;Sr.prototype.source=void 0;const bv={}.hasOwnProperty,fY=new Map,hY=/[A-Z]/g,pY=new Set(["table","tbody","thead","tfoot","tr"]),mY=new Set(["td","th"]),E3="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gY(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=kY(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=_Y(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?fo:Qf,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=x3(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function x3(e,t,n){if(t.type==="element")return yY(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return bY(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return xY(e,t,n);if(t.type==="mdxjsEsm")return EY(e,t);if(t.type==="root")return wY(e,t,n);if(t.type==="text")return vY(e,t)}function yY(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=fo,e.schema=s),e.ancestors.push(t);const i=v3(e,t.tagName,!1),a=NY(e,t);let o=xv(e,t);return pY.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!AK(c):!0})),w3(e,a,i,t),Ev(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function bY(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wf(e,t.position)}function EY(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wf(e,t.position)}function xY(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=fo,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:v3(e,t.name,!0),a=SY(e,t),o=xv(e,t);return w3(e,a,i,t),Ev(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function wY(e,t,n){const r={};return Ev(r,xv(e,t)),e.create(t,e.Fragment,r,n)}function vY(e,t){return t.value}function w3(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ev(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function _Y(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function kY(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=Bi(r);return t(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function NY(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&bv.call(t.properties,s)){const i=TY(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&mY.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function SY(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else wf(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else wf(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function xv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:fY;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i0?(fs(e,e.length,0,t),e):t}const gT={}.hasOwnProperty;function k3(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function di(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mr=ho(/[A-Za-z]/),_r=ho(/[\dA-Za-z]/),DY=ho(/[#-'*+\--9=?A-Z^-~]/);function Wm(e){return e!==null&&(e<32||e===127)}const TE=ho(/\d/),PY=ho(/[\dA-Fa-f]/),BY=ho(/[!-/:-@[-`{-~]/);function Je(e){return e!==null&&e<-2}function Qt(e){return e!==null&&(e<0||e===32)}function St(e){return e===-2||e===-1||e===32}const a0=ho(new RegExp("\\p{P}|\\p{S}","u")),sl=ho(/\s/);function ho(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function du(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Dt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return St(c)?(e.enter(n),o(c)):t(c)}function o(c){return St(c)&&i++a))return;const A=t.events.length;let S=A,C,R;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(C){R=t.events[S][1].end;break}C=!0}for(y(r),N=A;Nb;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function zY(e,t,n){return Dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $c(e){if(e===null||Qt(e)||sl(e))return 1;if(a0(e))return 2}function o0(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};bT(f,-c),bT(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Cs(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Cs(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=Cs(u,o0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Cs(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Cs(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,fs(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&St(N)?Dt(e,w,"linePrefix",i+1)(N):w(N)}function w(N){return N===null||Je(N)?e.check(ET,g,_)(N):(e.enter("codeFlowValue"),b(N))}function b(N){return N===null||Je(N)?(e.exit("codeFlowValue"),w(N)):(e.consume(N),b)}function _(N){return e.exit("codeFenced"),t(N)}function k(N,A,S){let C=0;return R;function R(D){return N.enter("lineEnding"),N.consume(D),N.exit("lineEnding"),O}function O(D){return N.enter("codeFencedFence"),St(D)?Dt(N,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):F(D)}function F(D){return D===o?(N.enter("codeFencedFenceSequence"),q(D)):S(D)}function q(D){return D===o?(C++,N.consume(D),q):C>=a?(N.exit("codeFencedFenceSequence"),St(D)?Dt(N,L,"whitespace")(D):L(D)):S(D)}function L(D){return D===null||Je(D)?(N.exit("codeFencedFence"),A(D)):S(D)}}}function tG(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Yy={name:"codeIndented",tokenize:rG},nG={partial:!0,tokenize:sG};function rG(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Dt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):Je(u)?e.attempt(nG,a,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Je(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function sG(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Dt(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):Je(a)?s(a):n(a)}}const iG={name:"codeText",previous:oG,resolve:aG,tokenize:lG};function aG(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Hu(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Hu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Hu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function I3(e,t,n,r,s,i,a,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),h):y===null||y===32||y===41||Wm(y)?n(y):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(o),h(y)):y===null||y===60||Je(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function g(y){return!d&&(y===null||y===41||Qt(y))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Je(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Je(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!St(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function O3(e,t,n,r,s,i){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),c(a)):h===null?n(h):Je(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Dt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Je(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Md(e,t){let n;return r;function r(s){return Je(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):St(s)?Dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const gG={name:"definition",tokenize:bG},yG={partial:!0,tokenize:EG};function bG(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return R3.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return s=di(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Qt(p)?Md(e,u)(p):u(p)}function u(p){return I3(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(yG,f,f)(p)}function f(p){return St(p)?Dt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Je(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function EG(e,t,n){return r;function r(o){return Qt(o)?Md(e,s)(o):n(o)}function s(o){return O3(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return St(o)?Dt(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Je(o)?t(o):n(o)}}const xG={name:"hardBreakEscape",tokenize:wG};function wG(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Je(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const vG={name:"headingAtx",resolve:_G,tokenize:kG};function _G(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},fs(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function kG(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Qt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Je(d)?(e.exit("atxHeading"),t(d)):St(d)?Dt(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Qt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const NG=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wT=["pre","script","style","textarea"],SG={concrete:!0,name:"htmlFlow",resolveTo:CG,tokenize:IG},TG={partial:!0,tokenize:OG},AG={partial:!0,tokenize:RG};function CG(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function IG(e,t,n){const r=this;let s,i,a,o,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),i=!0,g):B===63?(e.consume(B),s=3,r.interrupt?t:I):Mr(B)?(e.consume(B),a=String.fromCharCode(B),x):n(B)}function h(B){return B===45?(e.consume(B),s=2,p):B===91?(e.consume(B),s=5,o=0,m):Mr(B)?(e.consume(B),s=4,r.interrupt?t:I):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:I):n(B)}function m(B){const ie="CDATA[";return B===ie.charCodeAt(o++)?(e.consume(B),o===ie.length?r.interrupt?t:F:m):n(B)}function g(B){return Mr(B)?(e.consume(B),a=String.fromCharCode(B),x):n(B)}function x(B){if(B===null||B===47||B===62||Qt(B)){const ie=B===47,Q=a.toLowerCase();return!ie&&!i&&wT.includes(Q)?(s=1,r.interrupt?t(B):F(B)):NG.includes(a.toLowerCase())?(s=6,ie?(e.consume(B),y):r.interrupt?t(B):F(B)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?w(B):b(B))}return B===45||_r(B)?(e.consume(B),a+=String.fromCharCode(B),x):n(B)}function y(B){return B===62?(e.consume(B),r.interrupt?t:F):n(B)}function w(B){return St(B)?(e.consume(B),w):R(B)}function b(B){return B===47?(e.consume(B),R):B===58||B===95||Mr(B)?(e.consume(B),_):St(B)?(e.consume(B),b):R(B)}function _(B){return B===45||B===46||B===58||B===95||_r(B)?(e.consume(B),_):k(B)}function k(B){return B===61?(e.consume(B),N):St(B)?(e.consume(B),k):b(B)}function N(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,A):St(B)?(e.consume(B),N):S(B)}function A(B){return B===c?(e.consume(B),c=null,C):B===null||Je(B)?n(B):(e.consume(B),A)}function S(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Qt(B)?k(B):(e.consume(B),S)}function C(B){return B===47||B===62||St(B)?b(B):n(B)}function R(B){return B===62?(e.consume(B),O):n(B)}function O(B){return B===null||Je(B)?F(B):St(B)?(e.consume(B),O):n(B)}function F(B){return B===45&&s===2?(e.consume(B),T):B===60&&s===1?(e.consume(B),M):B===62&&s===4?(e.consume(B),K):B===63&&s===3?(e.consume(B),I):B===93&&s===5?(e.consume(B),U):Je(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(TG,W,q)(B)):B===null||Je(B)?(e.exit("htmlFlowData"),q(B)):(e.consume(B),F)}function q(B){return e.check(AG,L,W)(B)}function L(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),D}function D(B){return B===null||Je(B)?q(B):(e.enter("htmlFlowData"),F(B))}function T(B){return B===45?(e.consume(B),I):F(B)}function M(B){return B===47?(e.consume(B),a="",j):F(B)}function j(B){if(B===62){const ie=a.toLowerCase();return wT.includes(ie)?(e.consume(B),K):F(B)}return Mr(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),j):F(B)}function U(B){return B===93?(e.consume(B),I):F(B)}function I(B){return B===62?(e.consume(B),K):B===45&&s===2?(e.consume(B),I):F(B)}function K(B){return B===null||Je(B)?(e.exit("htmlFlowData"),W(B)):(e.consume(B),K)}function W(B){return e.exit("htmlFlow"),t(B)}}function RG(e,t,n){const r=this;return s;function s(a){return Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function OG(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Zf,t,n)}}const LG={name:"htmlText",tokenize:MG};function MG(e,t,n){const r=this;let s,i,a;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),k):I===63?(e.consume(I),b):Mr(I)?(e.consume(I),S):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,m):Mr(I)?(e.consume(I),w):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Je(I)?(a=f,M(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?T(I):I===45?h(I):f(I)}function m(I){const K="CDATA[";return I===K.charCodeAt(i++)?(e.consume(I),i===K.length?g:m):n(I)}function g(I){return I===null?n(I):I===93?(e.consume(I),x):Je(I)?(a=g,M(I)):(e.consume(I),g)}function x(I){return I===93?(e.consume(I),y):g(I)}function y(I){return I===62?T(I):I===93?(e.consume(I),y):g(I)}function w(I){return I===null||I===62?T(I):Je(I)?(a=w,M(I)):(e.consume(I),w)}function b(I){return I===null?n(I):I===63?(e.consume(I),_):Je(I)?(a=b,M(I)):(e.consume(I),b)}function _(I){return I===62?T(I):b(I)}function k(I){return Mr(I)?(e.consume(I),N):n(I)}function N(I){return I===45||_r(I)?(e.consume(I),N):A(I)}function A(I){return Je(I)?(a=A,M(I)):St(I)?(e.consume(I),A):T(I)}function S(I){return I===45||_r(I)?(e.consume(I),S):I===47||I===62||Qt(I)?C(I):n(I)}function C(I){return I===47?(e.consume(I),T):I===58||I===95||Mr(I)?(e.consume(I),R):Je(I)?(a=C,M(I)):St(I)?(e.consume(I),C):T(I)}function R(I){return I===45||I===46||I===58||I===95||_r(I)?(e.consume(I),R):O(I)}function O(I){return I===61?(e.consume(I),F):Je(I)?(a=O,M(I)):St(I)?(e.consume(I),O):C(I)}function F(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,q):Je(I)?(a=F,M(I)):St(I)?(e.consume(I),F):(e.consume(I),L)}function q(I){return I===s?(e.consume(I),s=void 0,D):I===null?n(I):Je(I)?(a=q,M(I)):(e.consume(I),q)}function L(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Qt(I)?C(I):(e.consume(I),L)}function D(I){return I===47||I===62||Qt(I)?C(I):n(I)}function T(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function M(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),j}function j(I){return St(I)?Dt(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return e.enter("htmlTextData"),a(I)}}const _v={name:"labelEnd",resolveAll:BG,resolveTo:FG,tokenize:UG},jG={tokenize:$G},DG={tokenize:HG},PG={tokenize:zG};function BG(e){let t=-1;const n=[];for(;++t=3&&(u===null||Je(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),St(u)?Dt(e,o,"whitespace")(u):o(u))}}const Vr={continuation:{tokenize:JG},exit:tW,name:"list",tokenize:ZG},XG={partial:!0,tokenize:nW},QG={partial:!0,tokenize:eW};function ZG(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:TE(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Xp,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return TE(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Zf,r.interrupt?n:d,e.attempt(XG,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return St(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function JG(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Zf,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Dt(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!St(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(QG,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Dt(e,e.attempt(Vr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function eW(e,t,n){const r=this;return Dt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function tW(e){e.exit(this.containerState.type)}function nW(e,t,n){const r=this;return Dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!St(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const vT={name:"setextUnderline",resolveTo:rW,tokenize:sW};function rW(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function sW(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),St(u)?Dt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Je(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const iW={tokenize:aW};function aW(e){const t=this,n=e.attempt(Zf,r,e.attempt(this.parser.constructs.flowInitial,s,Dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(dG,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oW={resolveAll:M3()},lW=L3("string"),cW=L3("text");function L3(e){return{resolveAll:M3(e==="text"?uW:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function _W(e,t){let n=-1;const r=[];let s;for(;++n"u")return{};try{const e=JSON.parse(localStorage.getItem(iv)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function iV(e,t,n){if(typeof window>"u")return;const r=ov();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(iv,JSON.stringify(r))}function fM(e){if(typeof window>"u")return;const t=av(e.runtimeId,e.appName,e.userId,e.sessionId),n=ov(),r=n[t];if(r){for(const s of e.eventIds)delete r[`veadk_feedback:${s}`];Object.keys(r).length===0?delete n[t]:n[t]=r,localStorage.setItem(iv,JSON.stringify(n))}}const Yp="",lv=new Map;function hM(e,t){lv.set(e,t)}function pM(){lv.clear()}function Qn(e){const t=lv.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function mt(e,t={},n={},r=cu){const s={...t,headers:Zg(t.headers)},i=()=>{const c={...s,signal:ci(t.signal,r)};if(n.runtimeId){const u=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(ji(`${Yp}/web/runtime-proxy/${n.runtimeId}${e}${u}`),c)}if(n.base){const u=new Headers(c.headers);return u.set("X-AgentKit-Base",n.base),n.apiKey&&u.set("X-AgentKit-Key",n.apiKey),fetch(ji(`${Yp}/agentkit-proxy${e}`),{...c,headers:u})}return fetch(ji(`${Yp}${e}`),c)},a=async c=>{if(eV(c))return!0;if(c.status!==401)return!1;try{return await Xz()}catch{return!1}};let o=await i();for(;await a(o);)await tV(t.signal),o=await i();return o}function aV(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return r?`${r}: ${s}`:s}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function En(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return aV(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function mM(){const e=await mt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Wf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class yc extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}const oV="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。";async function lV(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Jg(e,t,n){const r=await mt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await lV(r):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new Wf;if(n!=null&&n.runtimeId&&s==="runtime_private_endpoint_unreachable")throw new yc(oV);if(n!=null&&n.runtimeId&&r.status===404)throw new yc("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new yc("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await En(r,"读取 Agent 列表失败"));return r.json()}async function Vm(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!s.ok){const a=`创建会话失败 (${s.status})`,o=await En(s,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await s.json()).id}async function cv(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function Km(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},s);if(!i.ok)throw new Error(`get session failed: ${i.status}`);const a=await i.json();if(s.runtimeId){const o=av(s.runtimeId,r,t,n);a.state={...ov()[o]??{},...a.state??{}}}return a}async function gM(e){const{app:t,ep:n}=Qn(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");const r=await mt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Qg);if(!r.ok)throw new Error(await En(r,"提交反馈失败"));const s=await r.json(),i=av(n.runtimeId,t,e.userId,e.sessionId);return iV(i,e.eventId,s),s}async function yM(e){const t=new URLSearchParams({runtimeId:e.runtimeId,region:e.region??"cn-beijing",appName:e.appName,page_size:String(e.pageSize??100)}),n=await mt(`/web/evaluation/feedback-cases?${t.toString()}`);if(!n.ok)throw new Error(await En(n,"读取评测集失败"));return n.json()}async function bM(e){const t=await mt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:e.region??"cn-beijing",appName:e.appName,itemIds:e.itemIds})},{},Qg);if(!t.ok)throw new Error(await En(t,"删除评测案例失败"));return t.json()}async function fE(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!i.ok&&i.status!==404)throw new Error(`delete session failed: ${i.status}`)}async function cV(e){const t=await mt("/web/media/capabilities");if(!t.ok)throw new Error(await En(t,"media capabilities failed"));return t.json()}async function EM(e,t,n,r){const{app:s}=Qn(e),i=new FormData;i.set("app_name",s),i.set("user_id",t),i.set("session_id",n),i.set("file",r);const a=await mt("/web/media",{method:"POST",body:i},{},Qg);if(!a.ok)throw new Error(await En(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function hE(e,t,n){const{app:r}=Qn(e),s=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,i=await mt(s,{method:"DELETE"});if(!i.ok&&i.status!==404)throw new Error(await En(i,"media cleanup failed"))}function xM(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function Gp(e,t){const n=xM(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await mt(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await En(r,"media cleanup failed"))}function wM(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=xM(t);if(!n)return t;const r=`${n}/content`;return ji(`${Yp}${r}`)}async function vM(e,t){const{app:n,ep:r}=Qn(e),s=await mt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const i=s.headers.get("content-type")??"";if(!i.includes("application/json")){const o=i.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function uv(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function dv(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function _M(e,t,n){const{app:r,ep:s}=Qn(e),i=await mt(dv(r,t,n),{},s);if(!i.ok)throw new Error(await En(i,"读取会话能力失败"));return uv(await i.json())}async function kM(e){const{ep:t}=Qn(e),n=await mt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await En(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var i;return((i=s.name)==null?void 0:i.trim())??""}).filter(Boolean)}async function uV(e){const{ep:t}=Qn(e),n=await mt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await En(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function dV(e,t,n){const{ep:r}=Qn(e),s=new URLSearchParams({region:n||"cn-beijing"}),i=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await mt(i,{},r);if(!a.ok)throw new Error(await En(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function NM(e,t,n=1,r=20){const{ep:s}=Qn(e),i=new URLSearchParams({query:t,page_number:String(n),page_size:String(r)}),a=await mt(`/harness/skills/findskill?${i.toString()}`,{},s);if(!a.ok)throw new Error(await En(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function SM(e,t,n,r,s){const{app:i,ep:a}=Qn(e),o=await mt(dv(i,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:r.kind,name:r.name,skill_source_id:r.skillSourceId,description:r.description,version:r.version,expected_revision:s})},a);if(!o.ok)throw new Error(await En(o,"添加会话能力失败"));return uv(await o.json())}async function TM(e,t,n,r,s){const{app:i,ep:a}=Qn(e),o=`${dv(i,t,n)}/${encodeURIComponent(r)}?expected_revision=${s}`,c=await mt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await En(c,"移除会话能力失败"));return uv(await c.json())}async function AM(e,t){const n=await mt(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();if(!r.draft)try{const s=await mt(`/web/agent-draft/${e}`,{},t);if(s.ok){const i=await s.json();r.draft=i.draft}}catch{}return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function fv(e){const{app:t,ep:n}=Qn(e);return AM(t,n)}async function e0(e,t){const n={runtimeId:e,region:t},s=(await Jg("","",n))[0];if(!s)throw new Error("该 Runtime 未提供可预览的 Agent。");return AM(s,n)}async function CM(e,t,n,r){const{app:s,ep:i}=Qn(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:r}),o=await mt(`/web/search?${a.toString()}`,{},i);if(!o.ok)throw new Error(await En(o,"Agent 检索失败"));return o.json()}async function IM(e,t){const{app:n}=Qn(e),r=await mt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*bf({appName:e,userId:t,sessionId:n,text:r,attachments:s=[],invocation:i,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Qn(e),f=s.flatMap(g=>g.status&&g.status!=="ready"?[]:g.uri?[{fileData:{mimeType:g.mimeType,fileUri:g.uri,displayName:g.name},partMetadata:{veadkMedia:{id:g.id,uri:g.uri,name:g.name,mimeType:g.mimeType,sizeBytes:g.sizeBytes}}}]:g.data?[{inlineData:{mimeType:g.mimeType,data:g.data,displayName:g.name}}]:[]),h=i&&(i.skills.length>0||i.targetAgent)?i:void 0,p=[...f,...a.map(g=>({functionResponse:{id:g.id,name:g.name,response:g.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const g=p[0],x=g.partMetadata;p[0]={...g,partMetadata:{...x,veadkInvocation:h}}}const m=await mt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!m.ok)throw new Error(ep(`run_sse failed: ${m.status}`));for await(const g of sv(m)){const x=g;typeof x.error=="string"&&(x.error=ep(x.error)),typeof x.errorMessage=="string"&&(x.errorMessage=ep(x.errorMessage)),typeof x.error_message=="string"&&(x.error_message=ep(x.error_message)),yield x}}const Od=new Map;async function t0(e,t,n,r){var u,d,f;const s=r==null?void 0:r.taskId,i=s?new AbortController:void 0;s&&i&&Od.set(s,i);const a=()=>{s&&Od.get(s)===i&&Od.delete(s)};let o;try{(u=r==null?void 0:r.onStage)==null||u.call(r,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),o=await mt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:i==null?void 0:i.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:s,runtimeId:r==null?void 0:r.runtimeId,description:r==null?void 0:r.description,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0),(d=r==null?void 0:r.onStage)==null||d.call(r,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!o.ok){const h=await o.text().catch(()=>"");throw a(),new Error(h||`部署失败 (${o.status})`)}let c=null;try{for await(const h of sv(o)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=r==null?void 0:r.onStage)==null||f.call(r,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,feishuChannel:c.feishuChannel}}async function RM(e){var n;const t=await mt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=Od.get(e))==null||n.abort(),Od.delete(e)}async function fV(e="cn-beijing"){const t=await mt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Ef={title:"VeADK Studio",logoUrl:""},$y={studio:!1,version:"",branding:Ef,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function OM(){var e,t;try{const n=await mt("/web/ui-config");if(!n.ok)return $y;const r=await n.json(),s=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Ef.logoUrl;return{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Ef.title,logoUrl:s?ji(s):""},features:{...$y.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return $y}}const LM={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function MM(){var n,r,s;const e=await mt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function jM(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",s=await mt(`/web/studio-update${r}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function DM(e){const t=await mt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Qg);if(!t.ok){let n="";try{const r=await t.json();n=typeof r.detail=="string"?r.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function bc(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await mt(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function PM(e,t="cn-beijing"){try{return await Jg("","",{runtimeId:e,region:t})}catch(n){if(n instanceof Wf||n instanceof yc)throw n;return null}}async function BM(e,t="cn-beijing"){const n=await mt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function hv(e,t="cn-beijing"){const n=await mt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await En(n,"加载 Runtime 详情失败"));return n.json()}async function pv(e){const t=await mt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await En(t,"生成项目失败"));return t.json()}const hV=19e4;async function FM(e){const t=await mt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},hV);if(!t.ok)throw new Error(await En(t,"生成 Agent 配置失败"));return rv(t,"生成 Agent 配置失败")}async function UM(e){const t=await mt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await En(t,"创建调试运行失败"));return rv(t,"创建调试运行失败")}async function $M(e,t){const n=await mt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await En(n,"创建调试会话失败"));return(await rv(n,"创建调试会话失败")).id}async function*HM({runId:e,userId:t,sessionId:n,text:r,signal:s}){const i=r.trim()?[{text:r}]:[],a=await mt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:i},streaming:!0}),signal:s},{},0);if(!a.ok)throw new Error(await En(a,"调试运行失败"));for await(const o of sv(a))yield o}async function cd(e){const t=await mt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await En(t,"清理调试运行失败"))}const pV=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Ef,DEFAULT_STUDIO_ACCESS:LM,RuntimeAccessDeniedError:Wf,RuntimeProbeError:yc,addSessionCapability:SM,cancelAgentkitDeployment:RM,clearMessageFeedbackCache:fM,clearRemoteApps:pM,componentSearch:CM,createGeneratedAgentTestRun:UM,createGeneratedAgentTestSession:$M,createSession:Vm,deleteAgentFeedbackCases:bM,deleteGeneratedAgentTestRun:cd,deleteMedia:Gp,deleteRuntime:BM,deleteSession:fE,deleteSessionMedia:hE,deployAgentkitProject:t0,fetchRemoteApps:Jg,generateAgentDraftFromRequirement:FM,generateAgentProject:pv,getAgentFeedbackCases:yM,getAgentInfo:fv,getMediaCapabilities:cV,getMyRuntimes:fV,getRuntimeAgentInfo:e0,getRuntimeDetail:hv,getRuntimes:bc,getSession:Km,getSessionCapabilities:_M,getSessionTrace:vM,getStudioAccess:MM,getStudioUpdateStatus:jM,getUiConfig:OM,listApps:mM,listSessionBuiltinTools:kM,listSessionSkillSpaces:uV,listSessionSkillsInSpace:dV,listSessions:cv,mediaContentUrl:wM,probeRuntimeApps:PM,registerRemoteApp:hM,removeSessionCapability:TM,runGeneratedAgentTestSSE:HM,runSSE:bf,searchSessionPublicSkills:NM,startStudioUpdate:DM,submitMessageFeedback:gM,uploadMedia:EM,webSearch:IM},Symbol.toStringTag,{value:"Module"})),mV="send_a2ui_json_to_client",gV="validated_a2ui_json",pE="adk_request_credential",HS="transfer_to_agent";function yV(e){var r,s,i,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.rawAuthCredential)==null?void 0:i.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function si(){return{blocks:[],liveStart:0}}const zS=e=>e.functionCall??e.function_call,mE=e=>e.functionResponse??e.function_response;function bV(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function EV(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function zM(e){const t=[];for(const[n,r]of e.entries()){const s=r.partMetadata??r.part_metadata,i=s==null?void 0:s.veadkTransport;if((i==null?void 0:i.hidden)===!0)continue;const a=s==null?void 0:s.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:EV(o.data),name:o.displayName??o.display_name});continue}const c=r.fileData??r.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function gE(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const xV=new Set(["llm","sequential","parallel","loop","a2a"]);function wV(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const s=r,i=Array.isArray(s.skills)?s.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=s.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&xV.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(i.length>0||a)return{skills:i,targetAgent:a}}}function vV(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function VS(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function tp(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function Pc(e,t){var a,o,c,u;const n=e.blocks.map(d=>({...d}));let r=e.liveStart;const s=((a=t.content)==null?void 0:a.parts)??[],i=s.some(d=>zS(d)||mE(d));if(t.partial&&!i){for(const d of s){const f=gE(d);typeof f=="string"&&f&&VS(n,d.thought?"thinking":"text",f)}return{blocks:n,liveStart:r}}n.length=r;for(const d of s){const f=zS(d),h=mE(d),p=zM([d]),m=gE(d);if(typeof m=="string"&&m)VS(n,d.thought?"thinking":"text",m);else if(p.length)tp(n),vV(n,p);else if(f)if(tp(n),f.name===HS){const g=bV(f.args)||((o=t.actions)==null?void 0:o.transferToAgent)||((c=t.actions)==null?void 0:c.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:g,done:!1})}else if(f.name===pE){const g=f.args??{},x=g.authConfig??g.auth_config??g,w=String(g.functionCallId??g.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:f.id??"",label:w,authUri:yV(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:f.name??"",args:f.args,done:!1});else if(h){if(tp(n),h.name===HS)for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(h.name===pE)for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let g=n.length-1;g>=0;g--){const x=n[g];if(x.kind==="tool"&&!x.done&&x.name===h.name){x.done=!0,x.response=h.response;break}}if(h.name===mV){const g=((u=h.response)==null?void 0:u[gV])??[];if(g.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...g):n.push({kind:"a2ui",messages:g})}}}}return tp(n),r=n.length,{blocks:n,liveStart:r}}function _V(e,t={}){var s,i;const n=[];let r=si();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=mE(p))==null?void 0:m.name)===pE})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const g=n[p].blocks[m];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(gE).filter(p=>!!p).join(""),d=zM(c),f=wV(c);if(!u&&!d.length&&!f){r=si();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),r=si()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((i=u.meta)==null?void 0:i.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=si()),r=Pc(r,a),u.blocks=r.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function kV(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"新会话"}const NV=50,KS=48;function SV(e){return(e.events??[]).flatMap(t=>{var s,i;const r=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((i=t.content)==null?void 0:i.role)??"",ts:t.timestamp}]:[]})}function TV(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"未命名会话"}function AV(e,t,n){const r=Math.max(0,t-KS),s=Math.min(e.length,t+n+KS);return(r>0?"…":"")+e.slice(r,s).trim()+(s{var c;if((c=o.events)!=null&&c.length)return o;try{return await Km(t,e,o.id)}catch{return o}})),a=[];for(const o of i)for(const{text:c,role:u,ts:d}of SV(o)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:TV(o),snippet:AV(c,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,NV)}async function IV(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await IM(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:s,error:i}=n;return r?i?{results:[],note:i}:{results:s.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function RV(e,t,n,r){if(!t||!r.trim())return{results:[]};const s=await CM(t,e,r.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const i=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:i,sourceType:s.sourceType}:{type:"memory",index:o,content:a.content,sourceName:i,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function OV(e,t,n){return e==="session"?{results:await CV(n.userId,n.appId,t)}:e==="web"?IV(n.appId,t):RV(e,n.appId,n.userId,t)}function VM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function LV({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function MV({onClick:e}){return l.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"搜索",title:"搜索",children:[l.jsx(VM,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function jV(e,t,n){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),i=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:i(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&s.has("knowledge"),unavailableLabel:i("知识库")},{id:"memory",label:"长期记忆",ready:r&&s.has("memory"),unavailableLabel:i("长期记忆")}]}function Ym(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function YS(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function DV({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:s,onOpenSession:i}){var D,T;const[a,o]=E.useState("session"),[c,u]=E.useState(""),[d,f]=E.useState([]),[h,p]=E.useState(),[m,g]=E.useState(!1),[x,y]=E.useState(!1),[w,b]=E.useState(!1),_=E.useRef(0),k=E.useRef(null),N=jV(t,n,r),A=N.find(M=>M.id===a),S=a==="knowledge"?(D=n==null?void 0:n.components)==null?void 0:D.find(M=>M.source==="knowledgebase"||M.kind==="knowledgebase"):a==="memory"?(T=n==null?void 0:n.components)==null?void 0:T.find(M=>M.source==="long_term_memory"||M.kind==="memory"):void 0;E.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),y(!1),g(!1),b(!1)},[t]),E.useEffect(()=>{if(!w)return;function M(j){var U;(U=k.current)!=null&&U.contains(j.target)||b(!1)}return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[w]);async function C(M,j){var W;const U=M.trim();if(!U||!((W=N.find(B=>B.id===j))!=null&&W.ready))return;const I=++_.current;g(!0),y(!0);let K;try{K=await OV(j,U,{userId:e,appId:t})}catch(B){const ie=B instanceof Error?B.message:String(B);K={results:[],note:`搜索失败:${ie}`}}I===_.current&&(f(K.results),p(K.note),g(!1))}function R(M){_.current+=1,u(M),f([]),p(void 0),y(!1),g(!1)}function O(M){_.current+=1,o(M),b(!1),f([]),p(void 0),y(!1),g(!1)}const F=!!(A!=null&&A.ready),q=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(S==null?void 0:S.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(S==null?void 0:S.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",L=S!=null&&S.backend?Ym(S.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(A==null?void 0:A.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":w,onClick:()=>b(M=>!M),children:[l.jsx("span",{children:(A==null?void 0:A.label)??"搜索类型"}),L&&l.jsx("small",{children:L}),l.jsx(LV,{open:w})]}),w&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:N.map(M=>{var I,K;const j=M.id==="knowledge"?(I=n==null?void 0:n.components)==null?void 0:I.find(W=>W.source==="knowledgebase"||W.kind==="knowledgebase"):M.id==="memory"?(K=n==null?void 0:n.components)==null?void 0:K.find(W=>W.source==="long_term_memory"||W.kind==="memory"):void 0,U=j?[j.name,j.backend?Ym(j.backend):""].filter(Boolean).join(" · "):M.ready?M.description:M.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===M.id,disabled:!M.ready,onClick:()=>O(M.id),children:[l.jsx("span",{children:M.label}),U&&l.jsx("small",{children:U})]},M.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:M=>R(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),C(c,a))},placeholder:q,disabled:!F,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?l.jsx(Kt,{className:"icon spin"}):l.jsx(VM,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:F?x?m?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&x?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((M,j)=>l.jsx(PV,{result:M,agentLabel:s,onOpen:i},j)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(A==null?void 0:A.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function PV({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(iM,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${YS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(Xg,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(ev,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(GS,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Ym(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(GS,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Ym(e.sourceType)}`:"",e.ts?` · ${YS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function GS({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const mv="/assets/volcengine-DM14a-L-.svg",WS="(max-width: 860px)";function BV(){return l.jsxs("svg",{className:"icon sidebar-agent-face",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--left",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--right",d:"M15.5 10.7v2"})]})}function FV(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const UV={admin:"管理员",developer:"开发者",user:"普通用户"};function qS({role:e}){const t=UV[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function $V({version:e,onClose:t}){return E.useEffect(()=>{const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),Us.createPortal(l.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:l.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[l.jsxs("header",{className:"system-info-head",children:[l.jsx("h2",{id:"system-info-title",children:"系统信息"}),l.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:l.jsx(Zr,{className:"icon","aria-hidden":"true"})})]}),l.jsx("dl",{className:"system-info-meta",children:l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function HV({access:e,userInfo:t,version:n,onLogout:r}){const[s,i]=E.useState(!1),[a,o]=E.useState(!1),[c,u]=E.useState("");if(!t)return null;const d=Zz(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=FV(d||f||h),m=Jz(t),g=m===c?"":m;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>i(x=>!x),title:f?`${d} +${f}`:d,children:[l.jsxs("span",{className:`account-avatar${g?" has-image":""}`,style:p,children:[h,g?l.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:d}),l.jsx(qS,{role:e.role})]}),f&&f!==d&&l.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>i(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${g?" has-image":""}`,style:p,children:[h,g?l.jsx("img",{className:"account-avatar-image",src:g,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(g)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:d}),l.jsx(qS,{role:e.role})]}),f&&f!==d&&l.jsx("div",{className:"account-sub",children:f})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),o(!0)},children:[l.jsx(uo,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),r()},children:[l.jsx(Sz,{className:"icon"})," 退出登录"]})]})]}),a?l.jsx($V,{version:n,onClose:()=>o(!1)}):null]})}function zV({branding:e,sessions:t,currentSessionId:n,features:r,access:s,streamingSids:i,onNewChat:a,onSearch:o,onQuickCreate:c,onSkillCenter:u,onAddAgent:d,onMyAgents:f,onPickSession:h,onDeleteSession:p,userInfo:m,version:g,onLogout:x}){const y=C=>(r==null?void 0:r[C])!==!1,[w,b]=E.useState(null),_=E.useRef(typeof window<"u"&&window.matchMedia(WS).matches),[k,N]=E.useState(_.current),A=[...t].sort((C,R)=>(R.lastUpdateTime??0)-(C.lastUpdateTime??0)),S=()=>{_.current=!1,N(C=>!C),b(null)};return E.useEffect(()=>{const C=window.matchMedia(WS),R=O=>{O.matches?N(F=>F||(_.current=!0,!0)):_.current&&(_.current=!1,N(!1))};return C.addEventListener("change",R),()=>C.removeEventListener("change",R)},[]),l.jsxs("aside",{className:`sidebar ${k?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:a,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||mv,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:S,"aria-label":k?"展开侧边栏":"收起侧边栏",title:k?"展开侧边栏":"收起侧边栏",children:k?l.jsx(Oz,{className:"icon"}):l.jsx(Rz,{className:"icon"})})]}),y("newChat")&&l.jsxs("button",{className:"new-chat new-chat--conversation",onClick:a,"aria-label":"新会话",title:"新会话",children:[l.jsx(ir,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:"new-chat new-chat--agents",onClick:f,"aria-label":"智能体",title:"智能体",children:[l.jsx(BV,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),y("search")&&l.jsx(MV,{onClick:o})]}),y("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),y("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:a,"aria-label":"新建会话",title:"新建会话",children:l.jsx(ir,{className:"icon"})})]}),l.jsxs("div",{className:"history-list",children:[A.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),A.map(C=>{const R=kV(C.events);return l.jsxs("div",{className:`history-item ${C.id===n?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>h(C.id),title:R,children:[(i==null?void 0:i.has(C.id))&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:R})]}),l.jsx("button",{className:"history-more",title:"更多",onClick:()=>b(O=>O===C.id?null:C.id),children:l.jsx(cz,{className:"icon"})}),w===C.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>b(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{b(null),p(C.id)},children:[l.jsx(js,{className:"icon"})," 删除"]})})]})]},C.id)})]})]}),l.jsx(HV,{access:s,userInfo:m,version:g,onLogout:x})]})}const KM="veadk_agentkit_connections";function os(){try{const e=localStorage.getItem(KM);return e?JSON.parse(e):[]}catch{return[]}}function n0(e){try{localStorage.setItem(KM,JSON.stringify(e))}catch{}}function Ja(e,t){return`agentkit:${e}:${t}`}function YM(e){try{return new URL(e).host}catch{return e}}function uu(e){pM();for(const t of e)for(const n of t.apps)hM(Ja(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function GM(e,t,n,r,s,i){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:s,currentVersion:i},o=os(),c=o.findIndex(u=>u.runtimeId===e);return c===-1?o.push(a):o[c]=a,n0(o),uu(o),a}async function Ld(e,t,n,r){let s;try{s=await PM(e,n)}catch(o){throw o instanceof Wf&&Gm(e),o}if(!s||s.length===0)throw Gm(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const i=Object.fromEntries(s.map(o=>[o,t])),a=GM(e,t,n,s,i,r);return Ja(a.id,s[0])}async function WM(e,t,n,r){const s=t.trim().replace(/\/+$/,""),i=await Jg(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||YM(s),base:s,apiKey:n.trim(),apps:i,appLabels:r&&i.length>0?{[i[0]]:r}:void 0},o=[...os().filter(c=>c.base!==s),a];return n0(o),uu(o),a}function VV(e){const t=os().filter(n=>n.id!==e);return n0(t),uu(t),t}function Gm(e){const t=os().filter(n=>n.runtimeId!==e);return n0(t),uu(t),t}function qM(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),r=t.flatMap(s=>s.apps.map(i=>{var o;const a=((o=s.appLabels)==null?void 0:o[i])??i;return{id:Ja(s.id,i),label:a,app:i,remote:!0,host:s.runtimeId?s.name:YM(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...r]}const XS=Object.freeze(Object.defineProperty({__proto__:null,addConnection:WM,addRuntimeConnection:GM,buildAgentEntries:qM,connectRuntime:Ld,loadConnections:os,registerConnections:uu,remoteAppId:Ja,removeConnection:VV,removeRuntimeConnection:Gm},Symbol.toStringTag,{value:"Module"}));function Bc({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),l.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),l.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),l.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),l.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),l.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),l.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function yE({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),l.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),l.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),l.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function KV({className:e="icon"}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsxs("g",{transform:"translate(0 2)",children:[l.jsx("path",{d:"M11.6 3.5c.45 3.75 2.75 6.05 6.5 6.5-3.75.45-6.05 2.75-6.5 6.5-.45-3.75-2.75-6.05-6.5-6.5 3.75-.45 6.05-2.75 6.5-6.5Z"}),l.jsx("path",{d:"M18.7 3.8v3.4M20.4 5.5H17"})]})})}function XM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),l.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),l.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),l.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),l.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const QS=15,YV=1e4,GV=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function WV(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function QM(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function Hy(e,t=YV){return new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(i=>{clearTimeout(s),n(i)},i=>{clearTimeout(s),r(i)})})}function qV({open:e,onClose:t,variant:n="drawer",anchorTop:r=0,agentsSource:s,localApps:i,currentId:a,currentRuntime:o,runtimeScope:c,onSelect:u}){const[d,f]=E.useState([]),[h,p]=E.useState([""]),[m,g]=E.useState(0),[x,y]=E.useState(c==="mine"),[w,b]=E.useState(null),[_,k]=E.useState("cn-beijing"),[N,A]=E.useState(!1),[S,C]=E.useState(""),[R,O]=E.useState(""),[F,q]=E.useState(null),[L,D]=E.useState(new Set),[T,M]=E.useState(),[j,U]=E.useState("agent"),I=E.useRef(!1);function K(te){M(ge=>(ge==null?void 0:ge.runtimeId)===te.runtimeId?void 0:{runtimeId:te.runtimeId,name:te.name,region:te.region})}const W=E.useCallback(async te=>{if(d[te]){g(te);return}const ge=h[te];if(ge!==void 0){A(!0),C("");try{const we=await Hy(bc({nextToken:ge,pageSize:QS,region:_,scope:"all"}));f(Z=>{const me=[...Z];return me[te]=we.runtimes,me}),p(Z=>{const me=[...Z];return we.nextToken&&(me[te+1]=we.nextToken),me}),g(te)}catch(we){C(we instanceof Error?we.message:String(we))}finally{A(!1)}}},[h,d,_]),B=E.useCallback(async()=>{A(!0),C("");try{const te=[];let ge="";do{const we=await Hy(bc({scope:"mine",nextToken:ge,pageSize:100,region:_}));te.push(...we.runtimes),ge=we.nextToken}while(ge&&te.length<2e3);b(te)}catch(te){C(te instanceof Error?te.message:String(te))}finally{A(!1)}},[_]);E.useEffect(()=>{y(c==="mine"),f([]),p([""]),g(0),b(null),I.current=!1},[c]),E.useEffect(()=>{e&&s==="cloud"&&!x&&!I.current&&(I.current=!0,W(0))},[e,s,x,W]),E.useEffect(()=>{x&&w===null&&s==="cloud"&&B()},[x,w,s,B]),E.useEffect(()=>{e&&(M(void 0),U("agent"))},[e]);function ie(){D(new Set),x?(b(null),B()):(f([]),p([""]),g(0),I.current=!0,A(!0),C(""),Hy(bc({nextToken:"",pageSize:QS,region:_,scope:"all"})).then(te=>{f([te.runtimes]),p(te.nextToken?["",te.nextToken]:[""])}).catch(te=>C(te instanceof Error?te.message:String(te))).finally(()=>A(!1)))}function Q(te){te!==_&&(k(te),f([]),p([""]),g(0),b(null),D(new Set),I.current=!1)}const ee=!x&&(d[m+1]!==void 0||h[m+1]!==void 0);function ce(te){q(te.runtimeId),Ld(te.runtimeId,te.name,te.region).then(ge=>{u(ge),t()}).catch(ge=>{if(ge instanceof Wf){C(ge.message);return}if(ge instanceof yc){ge.unsupported&&D(we=>new Set(we).add(te.runtimeId)),C(ge.message);return}D(we=>new Set(we).add(te.runtimeId))}).finally(()=>q(null))}if(!e)return null;const fe=(x?w??[]:d[m]??[]).filter(te=>R?te.name.toLowerCase().includes(R.toLowerCase()):!0);return l.jsxs(l.Fragment,{children:[n==="drawer"?l.jsx("div",{className:"menu-scrim",onClick:t}):null,l.jsxs("div",{className:`agentsel agentsel--${n}${T&&n==="drawer"?" has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:n==="drawer"?{top:r,height:`min(640px, calc(100dvh - ${r}px - 10px))`}:void 0,children:[l.jsxs("div",{className:"agentsel-main",children:[l.jsxs("div",{className:"agentsel-head",children:[l.jsxs("span",{className:"agentsel-title",children:[l.jsx(Bc,{})," 选择 Agent"]}),l.jsxs("div",{className:"agentsel-head-actions",children:[s==="cloud"&&l.jsx("button",{className:"agentsel-refresh",onClick:ie,title:"刷新",disabled:N,children:l.jsx(oM,{className:`icon ${N?"spin":""}`})}),l.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:l.jsx(Zr,{className:"icon"})})]})]}),s==="local"?l.jsx("div",{className:"agentsel-body",children:i.length===0?l.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):l.jsx("ul",{className:"agentsel-list",children:i.map(te=>l.jsx("li",{children:l.jsxs("button",{className:`agentsel-item ${te===a?"active":""}`,onClick:()=>{u(te),t()},children:[l.jsx(Bc,{}),l.jsx("span",{className:"agentsel-item-name",children:te})]})},te))})}):l.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[l.jsxs("div",{className:"agentsel-tools",children:[l.jsxs("div",{className:"agentsel-search",children:[l.jsx(yf,{className:"icon"}),l.jsx("input",{value:R,onChange:te=>O(te.target.value),placeholder:"搜索 Runtime 名称"})]}),l.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:GV.map(te=>l.jsx("button",{type:"button",className:_===te.value?"active":"","aria-pressed":_===te.value,onClick:()=>Q(te.value),children:te.label},te.value))}),c==="all"&&l.jsxs("label",{className:"agentsel-mine",children:[l.jsx("input",{type:"checkbox",checked:x,onChange:te=>y(te.target.checked)}),"只看我创建的"]})]}),S&&l.jsx("div",{className:"agentsel-error",children:S}),l.jsxs("div",{className:"agentsel-listwrap",children:[fe.length===0&&!N?l.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):l.jsx("ul",{className:"agentsel-list",children:fe.map(te=>{const ge=L.has(te.runtimeId),we=F===te.runtimeId,Z=(o==null?void 0:o.runtimeId)===te.runtimeId,me=(T==null?void 0:T.runtimeId)===te.runtimeId;return l.jsx("li",{children:l.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${Z?"active":""} ${me?"is-previewed":""}`,title:te.runtimeId,children:[l.jsx(XM,{}),l.jsxs("div",{className:"agentsel-item-main",children:[l.jsx("span",{className:"agentsel-item-name",title:te.name,children:te.name}),l.jsxs("div",{className:"agentsel-item-meta",children:[l.jsx("span",{className:`agentsel-status is-${ge?"bad":nK(te.status)}`,children:ge?"不支持":ZM(te.status)}),te.isMine&&l.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),l.jsxs("div",{className:"agentsel-item-actions",children:[l.jsx("button",{type:"button",className:"agentsel-connect",disabled:we||Z,onClick:()=>ce(te),children:we?"连接中…":Z?"已连接":ge?"重试":"连接"}),n==="drawer"?l.jsx("button",{type:"button",className:`agentsel-info ${me?"active":""}`,"aria-label":`查看 ${te.name} 信息`,"aria-pressed":me,title:"查看信息",onClick:()=>K(te),children:l.jsx(uo,{className:"icon"})}):null]})]})},te.runtimeId)})}),N&&l.jsxs("div",{className:"agentsel-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载中…"]})]}),l.jsxs("div",{className:"agentsel-pager",children:[l.jsx("button",{disabled:x||m===0||N,onClick:()=>void W(m-1),"aria-label":"上一页",children:l.jsx(iz,{className:"icon"})}),l.jsx("span",{className:"agentsel-pager-label",children:x?1:m+1}),l.jsx("button",{disabled:x||!ee||N,onClick:()=>void W(m+1),"aria-label":"下一页",children:l.jsx(Ms,{className:"icon"})})]})]})]}),n==="drawer"&&s==="cloud"&&T&&l.jsx(JV,{runtime:T,tab:j,onTabChange:U})]})]})}const XV={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function QV(e){return XV[e.toLowerCase()]??e}function ZV(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function JV({runtime:e,tab:t,onTabChange:n}){return l.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[l.jsx("div",{className:"agentsel-head agentsel-preview-head",children:l.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[l.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),l.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),l.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),l.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:l.jsx(eK,{runtime:e})}),l.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:l.jsx(tK,{runtime:e})})]})}function eK({runtime:e}){const[t,n]=E.useState(null),[r,s]=E.useState(!0),[i,a]=E.useState(""),o=e.runtimeId,c=e.region;E.useEffect(()=>{let d=!0;return n(null),s(!0),a(""),e0(o,c).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(QM(h))}).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=(t==null?void 0:t.components)??[];return l.jsx("div",{className:"agentsel-detail-body",children:r?l.jsxs("div",{className:"agentsel-panel-state",children:[l.jsx(Kt,{className:"icon spin"})," 读取 Agent 信息…"]}):i?l.jsxs("div",{className:"agentsel-panel-empty",children:[l.jsx("span",{children:"暂时无法读取 Agent 信息"}),l.jsx("small",{title:i,children:i})]}):t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agentsel-identity",children:[l.jsx(Bc,{className:"agentsel-identity-icon"}),l.jsxs("div",{className:"agentsel-identity-copy",children:[l.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsx("h3",{children:"描述"}),l.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&l.jsx(ZS,{icon:l.jsx(aM,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&l.jsx(ZS,{icon:l.jsx(yE,{}),title:"工具",values:t.tools}),l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(KV,{})," 技能"]}),t.skillsPreviewSupported?t.skills.length>0?l.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>l.jsxs("div",{className:"agentsel-info-list-item",children:[l.jsx("strong",{title:d.name,children:d.name}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},d.name))}):l.jsx("div",{className:"agentsel-info-empty",children:"未配置"}):l.jsx("div",{className:"agentsel-info-empty",children:"暂不支持预览"})]}),u.length>0&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(XL,{className:"icon"})," 挂载组件"]}),l.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>l.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[l.jsxs("div",{className:"agentsel-component-head",children:[l.jsx("strong",{title:d.name,children:d.name}),l.jsxs("span",{children:[QV(d.kind),d.backend?` · ${ZV(d.backend)}`:""]})]}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skillsPreviewSupported&&t.skills.length===0&&u.length===0&&l.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function ZS({icon:e,title:t,values:n}){return l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[e,t]}),l.jsx("div",{className:"agentsel-chips",children:n.map((r,s)=>l.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${s}`))})]})}function tK({runtime:e}){const[t,n]=E.useState(null),[r,s]=E.useState(!0),[i,a]=E.useState(""),o=e.runtimeId,c=e.region;E.useEffect(()=>{let d=!0;return s(!0),a(""),n(null),hv(o,c).then(f=>d&&n(f)).catch(f=>d&&a(QM(f instanceof Error?f.message:String(f)))).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",ZM(t.status)]),t.region&&u.push(["区域",WV(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return l.jsxs("div",{className:"agentsel-detail-body",children:[l.jsxs("div",{className:"agentsel-runtime-identity",children:[l.jsx(XM,{}),l.jsxs("div",{children:[l.jsx("strong",{title:e.name,children:e.name}),l.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?l.jsxs("div",{className:"agentsel-apps-note",children:[l.jsx(Kt,{className:"icon spin"})," 读取详情…"]}):i?l.jsx("div",{className:"agentsel-error",children:i}):t?l.jsxs(l.Fragment,{children:[l.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>l.jsxs("div",{className:"agentsel-kv-row",children:[l.jsx("dt",{children:d}),l.jsx("dd",{children:f})]},d))}),t.envs.length>0&&l.jsxs("div",{className:"agentsel-envs",children:[l.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>l.jsxs("div",{className:"agentsel-env",children:[l.jsx("span",{className:"agentsel-env-k",children:d.key}),l.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function nK(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const rK={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function ZM(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return rK[t]??(e||"-")}function sK({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o,title:c,titleLeading:u,crumbs:d,rightContent:f}){return l.jsxs("div",{className:"navbar",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx("div",{className:"navbar-default",children:d&&d.length>0?l.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:d.map((h,p)=>l.jsxs(E.Fragment,{children:[p>0&&l.jsx(Ms,{className:"crumb-sep"}),h.onClick?l.jsx("button",{className:"crumb crumb-link",onClick:h.onClick,children:h.label}):l.jsx("span",{className:"crumb crumb-current",children:h.label})]},p))}):c?l.jsxs("div",{className:"navbar-title-group",children:[u,l.jsx("div",{className:"navbar-title",title:c,children:c})]}):l.jsxs("div",{className:"navbar-title-group",children:[u,l.jsx(iK,{appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o})]})}),l.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),l.jsxs("div",{className:"navbar-right",children:[l.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),f]})]})}function iK({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,onBrowseAgents:o}){const[c,u]=E.useState(!1),d=h=>n?n(h):h;if(r==="cloud")return l.jsxs("div",{className:"agent-switch",children:[l.jsx("span",{className:"agent-dd-current",children:e?d(e):"选择 Agent"}),e&&o?l.jsx("button",{type:"button",className:"agent-switch-action","aria-label":"切换智能体",title:"切换智能体",onClick:o,children:l.jsx(tz,{"aria-hidden":"true"})}):null]});function f(){u(!1)}return l.jsxs("div",{className:"agent-dd",children:[l.jsxs("button",{className:"agent-dd-trigger",onClick:()=>u(h=>!h),children:[l.jsx("span",{className:"agent-dd-current",children:e?d(e):"选择 Agent"}),l.jsx(Xw,{className:`agent-dd-chev ${c?"open":""}`})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:f}),l.jsx(qV,{open:!0,variant:"navbar",agentsSource:r,localApps:s,currentId:e,currentRuntime:i,runtimeScope:a,onSelect:h=>{t(h),f()},onClose:f})]})]})}async function qf(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,cu)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function JM(){return(await qf("/web/skill-spaces?region=all")).items||[]}async function aK(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),qf(`/web/skill-spaces?${t.toString()}`)}async function e3(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function oK(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function lK(e,t,n,r,s){const i=[];n&&i.push(`version=${encodeURIComponent(n)}`),r&&i.push(`region=${encodeURIComponent(r)}`),s&&i.push(`project=${encodeURIComponent(s)}`);const a=i.length>0?`?${i.join("&")}`:"";return qf(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function cK(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function uK(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const dK="https://ark.cn-beijing.volces.com/api/v3/",Wp=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:dK}],Fc=[],Hu=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],ui={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},t3=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:ui.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:ui.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:ui.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],rl=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:Fc},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:Fc},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],bE=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],EE=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Wp,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:Fc},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],Uc="viking",xE=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:Fc},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Wp],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...Fc,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],wE=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...Fc,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],fK={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function vE(e){const t=rl.find(n=>n.id===e||n.toolNames.includes(e));return fK[e]??(t==null?void 0:t.label)??e}function JS(e){const t=rl.find(r=>r.id===e||r.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function hK(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function pK(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),l.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function eT(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function n3({title:e,description:t,icon:n,wide:r=!1,onClose:s,children:i}){const a=E.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return E.useEffect(()=>{const o=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=o}},[s]),Us.createPortal(l.jsxs("div",{className:"session-capability-dialog-layer",children:[l.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),l.jsxs("section",{className:`session-capability-dialog${r?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[l.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&l.jsx("span",{className:"session-capability-dialog-mark",children:n}),l.jsxs("div",{children:[l.jsx("h2",{id:a.current,children:e}),l.jsx("p",{children:t})]}),l.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:s,children:l.jsx(hK,{})})]}),i]})]}),document.body)}function qp({value:e,placeholder:t,label:n,onChange:r,autoFocus:s=!1}){return l.jsxs("label",{className:"session-capability-search",children:[l.jsx(pK,{}),l.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:i=>r(i.target.value)})]})}function mK({agentName:e,tools:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=E.useState(""),[c,u]=E.useState(""),d=E.useMemo(()=>new Set(n),[n]),f=E.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${vE(m)} ${m} ${JS(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&i()};return l.jsx(n3,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:l.jsx(yE,{}),onClose:i,children:l.jsxs("div",{className:"session-tool-dialog-body",children:[l.jsx(qp,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:o,autoFocus:!0}),l.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),g=c===p;return l.jsxs("article",{className:"session-tool-option",role:"listitem",children:[l.jsx("span",{className:"session-tool-option-icon",children:l.jsx(yE,{})}),l.jsxs("span",{className:"session-tool-option-copy",children:[l.jsx("strong",{children:vE(p)}),l.jsx("code",{children:p}),l.jsx("span",{children:JS(p)})]}),l.jsx("button",{type:"button",disabled:m||r||!!c,onClick:()=>void h(p),children:m?"已添加":g?"添加中…":"添加"})]},p)})})]})})}function gK({appName:e,agentName:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=E.useState("public"),[c,u]=E.useState(""),[d,f]=E.useState([]),[h,p]=E.useState(0),[m,g]=E.useState(!0),[x,y]=E.useState(""),[w,b]=E.useState([]),[_,k]=E.useState(null),[N,A]=E.useState([]),[S,C]=E.useState(""),[R,O]=E.useState(""),[F,q]=E.useState(!0),[L,D]=E.useState(!1),[T,M]=E.useState(""),[j,U]=E.useState(""),I=E.useMemo(()=>new Set(n),[n]);E.useEffect(()=>{if(a!=="public")return;let Q=!0;const ee=window.setTimeout(()=>{g(!0),y(""),NM(e,c.trim()).then(ce=>{Q&&(f(ce.items),p(ce.totalCount))}).catch(ce=>{Q&&(f([]),p(0),y(ce instanceof Error?ce.message:"搜索 Skill Hub 失败"))}).finally(()=>{Q&&g(!1)})},250);return()=>{Q=!1,window.clearTimeout(ee)}},[e,c,a]),E.useEffect(()=>{if(a!=="agentkit")return;let Q=!0;return q(!0),M(""),JM().then(ee=>{Q&&(b(ee),k(ee[0]??null))}).catch(ee=>{Q&&M(ee instanceof Error?ee.message:"读取 Skill Space 失败")}).finally(()=>{Q&&q(!1)}),()=>{Q=!1}},[a]),E.useEffect(()=>{if(a!=="agentkit")return;if(!_){A([]);return}let Q=!0;return D(!0),M(""),e3(_.id,_.region).then(ee=>{Q&&A(ee)}).catch(ee=>{Q&&M(ee instanceof Error?ee.message:"读取技能失败")}).finally(()=>{Q&&D(!1)}),()=>{Q=!1}},[_,a]);const K=E.useMemo(()=>{const Q=S.trim().toLowerCase();return Q?w.filter(ee=>`${ee.name} ${ee.id} ${ee.description}`.toLowerCase().includes(Q)):w},[S,w]),W=E.useMemo(()=>{const Q=R.trim().toLowerCase();return Q?N.filter(ee=>`${ee.skillName} ${ee.skillDescription}`.toLowerCase().includes(Q)):N},[R,N]),B=async Q=>{if(!_)return;U(Q.skillId);const ee=await s({kind:"skill",name:Q.skillName,skillSourceId:_.id,description:Q.skillDescription,version:Q.version});U(""),ee&&i()},ie=async Q=>{U(Q.slug);const ee=await s({kind:"skill",name:Q.name,skillSourceId:`findskill:${Q.slug}`,description:Q.description,version:Q.version||Q.updatedAt});U(""),ee&&i()};return l.jsx(n3,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:i,children:l.jsxs("div",{className:"session-skill-dialog-body",children:[l.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>o("public"),children:["Skill Hub",l.jsx("span",{children:"公域"})]}),l.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>o("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?l.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[l.jsxs("div",{className:"session-public-skill-head",children:[l.jsx(qp,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),l.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),l.jsx("div",{className:"session-public-skill-list",children:x?l.jsx("div",{className:"session-capability-error",children:x}):m?l.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(Q=>{const ee=I.has(Q.name),ce=j===Q.slug;return l.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:Q.name}),l.jsx("span",{children:Q.description||"暂无描述"}),l.jsxs("small",{children:[Q.sourceRepo||Q.sourceType||"FindSkill",l.jsx("span",{"aria-hidden":"true",children:" · "}),Q.downloadCount.toLocaleString()," 次下载",Q.evaluationScore>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:" · "}),Q.evaluationScore.toFixed(1)," 分"]})]})]}),l.jsx("button",{type:"button",disabled:ee||r||!!j,onClick:()=>void ie(Q),children:ee?"已添加":ce?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(eT,{}),"添加"]})})]},Q.slug)})})]}):l.jsxs("div",{className:"session-skill-browser",children:[l.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"Skill Space"}),l.jsx("span",{children:w.length})]}),l.jsx(qp,{value:S,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:C,autoFocus:!0})]}),l.jsx("div",{className:"session-skill-pane-list",children:F?l.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):K.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):K.map(Q=>l.jsx("button",{type:"button",className:`session-skill-space${(_==null?void 0:_.id)===Q.id?" is-active":""}`,onClick:()=>{k(Q),O("")},children:l.jsxs("span",{children:[l.jsx("strong",{children:Q.name||Q.id}),l.jsx("small",{children:Q.description||Q.id}),l.jsxs("em",{children:[Q.skillCount??0," 个技能"]})]})},`${Q.projectName??"default"}:${Q.id}`))})]}),l.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{title:_==null?void 0:_.name,children:(_==null?void 0:_.name)||"选择 Skill Space"}),l.jsx("span",{children:N.length})]}),l.jsx(qp,{value:R,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:O})]}),l.jsx("div",{className:"session-skill-pane-list",children:T?l.jsx("div",{className:"session-capability-error",children:T}):_?L?l.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):W.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):W.map(Q=>{const ee=I.has(Q.skillName),ce=j===Q.skillId;return l.jsxs("article",{className:"session-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:Q.skillName}),l.jsx("span",{children:Q.skillDescription||"暂无描述"}),l.jsxs("small",{children:["版本 ",Q.version||"—"]})]}),l.jsx("button",{type:"button",disabled:ee||r||!!j,onClick:()=>void B(Q),children:ee?"已添加":ce?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(eT,{}),"添加"]})})]},`${Q.skillId}:${Q.version}`)}):l.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function pa({as:e="span",className:t="",duration:n=4,spread:r=20,children:s,style:i,...a}){const o=Math.min(Math.max(r,5),45);return l.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...i,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:s})}const yK={llm:"LLM",sequential:"顺序",parallel:"并行",loop:"循环",a2a:"A2A"};function r3(e){return 1+e.children.reduce((t,n)=>t+r3(n),0)}function $c(e){return e.id||e.name}function bK(e,t){const n=$c(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function s3(e,t=!0){return{...e,id:$c(e),name:bK(e,t),children:e.children.map(n=>s3(n,!1))}}function i3(e,t){t.set($c(e),e.name||$c(e)),e.children.forEach(n=>i3(n,t))}function EK(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function xK(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function a3({node:e,activeAgent:t,seen:n,path:r}){const s=$c(e),i=!!s&&s===t,a=!!s&&!i&&r.has(s),o=!!s&&!i&&!a&&n.has(s);return l.jsxs("div",{className:"topo-branch",children:[l.jsxs("div",{className:`topo-node topo-type-${e.type} ${i?"is-active":""} ${a?"is-onpath":""} ${o?"is-done":""}`,title:e.description||e.name,children:[l.jsx(Bc,{className:"topo-icon"}),l.jsx("span",{className:"topo-name",children:e.name||"未命名 Agent"}),l.jsx("span",{className:"topo-badge",children:yK[e.type]??"Agent"})]}),i&&e.type==="a2a"&&l.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&l.jsx("div",{className:"topo-children",children:e.children.map(c=>l.jsx(a3,{node:c,activeAgent:t,seen:n,path:r},$c(c)))})]})}function zy({title:e,count:t}){return l.jsxs("div",{className:"topo-module-title",children:[l.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&l.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function o3({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i=[],variant:a="rail",capabilities:o=null,capabilityLoading:c=!1,capabilityMutating:u=!1,builtinTools:d=[],onAddCapability:f,onRemoveCapability:h}){const[p,m]=E.useState(null);if(n&&!t)return l.jsx("aside",{className:`topo is-loading${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:l.jsx(pa,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const g=s3(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),x=(o==null?void 0:o.tools)??EK(t.tools).map(k=>({id:`base:tool:${k}`,kind:"tool",name:k,custom:!1})),y=(o==null?void 0:o.skills)??xK(t.skills).map(k=>({id:`base:skill:${k.name}`,kind:"skill",name:k.name,description:k.description,custom:!1})),w=!!(o&&f&&h),b=new Set(i),_=new Map;return i3(g,_),l.jsxs("aside",{className:`topo${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[l.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[l.jsxs("div",{className:"topo-agent-heading",children:[l.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]}),t.description&&l.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),l.jsxs("div",{className:"topo-module-stack",children:[l.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[l.jsx(zy,{title:"工具",count:x.length}),l.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:x.length>0?l.jsx("div",{className:"topo-tool-list",children:x.map(k=>l.jsxs("div",{className:"topo-tool",title:k.name,children:[l.jsxs("span",{className:"topo-capability-title",children:[l.jsxs("span",{className:"topo-capability-copy",children:[l.jsx("span",{className:"topo-capability-name",children:vE(k.name)}),l.jsx("code",{children:k.name})]}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]},k.id))}):l.jsx("div",{className:"topo-empty",children:"未配置"})}),w&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:c||u,onClick:()=>m("tool"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加工具"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[l.jsx(zy,{title:"技能",count:t.skillsPreviewSupported?y.length:void 0}),l.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?y.length>0?l.jsx("div",{className:"topo-skill-list",children:y.map(k=>l.jsxs("div",{className:"topo-skill",title:k.description||k.name,children:[l.jsxs("div",{className:"topo-skill-title",children:[l.jsx("span",{className:"topo-skill-name",children:k.name}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]}),k.description&&l.jsx("span",{className:"topo-skill-description",children:k.description})]},`${k.name}:${k.description}`))}):l.jsx("div",{className:"topo-empty",children:"未配置"}):l.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),w&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:c||u,onClick:()=>m("skill"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加技能"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 拓扑",children:[l.jsx(zy,{title:"拓扑",count:r3(g)}),l.jsxs("div",{className:"topo-module-scroll topo-topology-scroll",role:"region","aria-label":"Agent 拓扑列表",tabIndex:0,children:[i.length>1&&l.jsx("div",{className:"topo-path","aria-label":"执行路径",children:i.map((k,N)=>l.jsx("span",{className:"topo-path-seg",children:l.jsx("span",{className:N===i.length-1?"topo-path-name is-current":"topo-path-name",children:_.get(k)??k})},`${k}-${N}`))}),l.jsx("div",{className:"topo-tree",children:l.jsx(a3,{node:g,activeAgent:r,seen:s,path:b})})]})]})]}),p==="tool"&&f&&l.jsx(mK,{agentName:t.name,tools:d,selectedNames:x.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)}),p==="skill"&&f&&l.jsx(gK,{appName:e,agentName:t.name,selectedNames:y.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)})]})}function wK(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function vK({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,onClose:h,returnFocusRef:p}){return E.useEffect(()=>{const m=document.body.style.overflow;document.body.style.overflow="hidden";const g=x=>{x.key==="Escape"&&h()};return document.addEventListener("keydown",g),()=>{var x;document.removeEventListener("keydown",g),document.body.style.overflow=m,(x=p.current)==null||x.focus()}},[h,p]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim agent-info-scrim",onClick:h}),l.jsxs("aside",{className:"drawer drawer--agent-info",role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-drawer-title",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{id:"agent-info-drawer-title",className:"drawer-title",children:"Agent 信息"}),l.jsx("div",{className:"drawer-sub",children:"能力与协作拓扑"})]}),l.jsx("button",{type:"button",className:"drawer-close",onClick:h,"aria-label":"关闭 Agent 信息",autoFocus:!0,children:l.jsx(wK,{})})]}),l.jsx("div",{className:"agent-info-drawer-body",children:t||n?l.jsx(o3,{appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,variant:"drawer"}):l.jsx("div",{className:"drawer-empty",children:"暂时无法读取 Agent 信息。"})})]})]})}function Fbe(){}function tT(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function l3(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _K=/[$_\p{ID_Start}]/u,kK=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,NK=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,SK=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TK=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c3={};function Ube(e){return e?_K.test(String.fromCodePoint(e)):!1}function $be(e,t){const r=(t||c3).jsx?NK:kK;return e?r.test(String.fromCodePoint(e)):!1}function nT(e,t){return(c3.jsx?TK:SK).test(e)}const AK=/[ \t\n\f\r]/g;function CK(e){return typeof e=="object"?e.type==="text"?rT(e.value):!1:rT(e)}function rT(e){return e.replace(AK,"")===""}let Xf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Xf.prototype.normal={};Xf.prototype.property={};Xf.prototype.space=void 0;function u3(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Xf(n,r,t)}function xf(e){return e.toLowerCase()}class Jr{constructor(t,n){this.attribute=n,this.property=t}}Jr.prototype.attribute="";Jr.prototype.booleanish=!1;Jr.prototype.boolean=!1;Jr.prototype.commaOrSpaceSeparated=!1;Jr.prototype.commaSeparated=!1;Jr.prototype.defined=!1;Jr.prototype.mustUseProperty=!1;Jr.prototype.number=!1;Jr.prototype.overloadedBoolean=!1;Jr.prototype.property="";Jr.prototype.spaceSeparated=!1;Jr.prototype.space=void 0;let IK=0;const bt=pl(),$n=pl(),_E=pl(),Le=pl(),tn=pl(),Ec=pl(),is=pl();function pl(){return 2**++IK}const kE=Object.freeze(Object.defineProperty({__proto__:null,boolean:bt,booleanish:$n,commaOrSpaceSeparated:is,commaSeparated:Ec,number:Le,overloadedBoolean:_E,spaceSeparated:tn},Symbol.toStringTag,{value:"Module"})),Vy=Object.keys(kE);class gv extends Jr{constructor(t,n,r,s){let i=-1;if(super(t,n),sT(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&jK.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(iT,PK);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!iT.test(i)){let a=i.replace(MK,DK);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=gv}return new s(r,t)}function DK(e){return"-"+e.toLowerCase()}function PK(e){return e.charAt(1).toUpperCase()}const Qf=u3([d3,RK,p3,m3,g3],"html"),fo=u3([d3,OK,p3,m3,g3],"svg");function aT(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function y3(e){return e.join(" ").trim()}var yv={},oT=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,BK=/\n/g,FK=/^\s*/,UK=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,$K=/^:\s*/,HK=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,zK=/^[;\s]*/,VK=/^\s+|\s+$/g,KK=` +`,lT="/",cT="*",Oo="",YK="comment",GK="declaration";function WK(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var g=m.match(BK);g&&(n+=g.length);var x=m.lastIndexOf(KK);r=~x?m.length-x:r+m.length}function i(){var m={line:n,column:r};return function(g){return g.position=new a(m),u(),g}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var g=new Error(t.source+":"+n+":"+r+": "+m);if(g.reason=m,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(m){var g=m.exec(e);if(g){var x=g[0];return s(x),e=e.slice(x.length),g}}function u(){c(FK)}function d(m){var g;for(m=m||[];g=f();)g!==!1&&m.push(g);return m}function f(){var m=i();if(!(lT!=e.charAt(0)||cT!=e.charAt(1))){for(var g=2;Oo!=e.charAt(g)&&(cT!=e.charAt(g)||lT!=e.charAt(g+1));)++g;if(g+=2,Oo===e.charAt(g-1))return o("End of comment missing");var x=e.slice(2,g-2);return r+=2,s(x),e=e.slice(g),r+=2,m({type:YK,comment:x})}}function h(){var m=i(),g=c(UK);if(g){if(f(),!c($K))return o("property missing ':'");var x=c(HK),y=m({type:GK,property:uT(g[0].replace(oT,Oo)),value:x?uT(x[0].replace(oT,Oo)):Oo});return c(zK),y}}function p(){var m=[];d(m);for(var g;g=h();)g!==!1&&(m.push(g),d(m));return m}return u(),p()}function uT(e){return e?e.replace(VK,Oo):Oo}var qK=WK,XK=cm&&cm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yv,"__esModule",{value:!0});yv.default=ZK;const QK=XK(qK);function ZK(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,QK.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var s0={};Object.defineProperty(s0,"__esModule",{value:!0});s0.camelCase=void 0;var JK=/^--[a-zA-Z0-9_-]+$/,eY=/-([a-z])/g,tY=/^[^-]+$/,nY=/^-(webkit|moz|ms|o|khtml)-/,rY=/^-(ms)-/,sY=function(e){return!e||tY.test(e)||JK.test(e)},iY=function(e,t){return t.toUpperCase()},dT=function(e,t){return"".concat(t,"-")},aY=function(e,t){return t===void 0&&(t={}),sY(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(rY,dT):e=e.replace(nY,dT),e.replace(eY,iY))};s0.camelCase=aY;var oY=cm&&cm.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},lY=oY(yv),cY=s0;function NE(e,t){var n={};return!e||typeof e!="string"||(0,lY.default)(e,function(r,s){r&&s&&(n[(0,cY.camelCase)(r,t)]=s)}),n}NE.default=NE;var uY=NE;const dY=Bf(uY),i0=b3("end"),Bi=b3("start");function b3(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fY(e){const t=Bi(e),n=i0(e);if(t&&n)return{start:t,end:n}}function Md(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?fT(e.position):"start"in e||"end"in e?fT(e):"line"in e||"column"in e?SE(e):""}function SE(e){return hT(e&&e.line)+":"+hT(e&&e.column)}function fT(e){return SE(e&&e.start)+"-"+SE(e&&e.end)}function hT(e){return e&&typeof e=="number"?e:1}class Sr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Md(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Sr.prototype.file="";Sr.prototype.name="";Sr.prototype.reason="";Sr.prototype.message="";Sr.prototype.stack="";Sr.prototype.column=void 0;Sr.prototype.line=void 0;Sr.prototype.ancestors=void 0;Sr.prototype.cause=void 0;Sr.prototype.fatal=void 0;Sr.prototype.place=void 0;Sr.prototype.ruleId=void 0;Sr.prototype.source=void 0;const bv={}.hasOwnProperty,hY=new Map,pY=/[A-Z]/g,mY=new Set(["table","tbody","thead","tfoot","tr"]),gY=new Set(["td","th"]),E3="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yY(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=NY(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=kY(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?fo:Qf,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=x3(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function x3(e,t,n){if(t.type==="element")return bY(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return EY(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return wY(e,t,n);if(t.type==="mdxjsEsm")return xY(e,t);if(t.type==="root")return vY(e,t,n);if(t.type==="text")return _Y(e,t)}function bY(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=fo,e.schema=s),e.ancestors.push(t);const i=v3(e,t.tagName,!1),a=SY(e,t);let o=xv(e,t);return mY.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!CK(c):!0})),w3(e,a,i,t),Ev(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function EY(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wf(e,t.position)}function xY(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wf(e,t.position)}function wY(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=fo,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:v3(e,t.name,!0),a=TY(e,t),o=xv(e,t);return w3(e,a,i,t),Ev(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function vY(e,t,n){const r={};return Ev(r,xv(e,t)),e.create(t,e.Fragment,r,n)}function _Y(e,t){return t.value}function w3(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ev(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function kY(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function NY(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=Bi(r);return t(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function SY(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&bv.call(t.properties,s)){const i=AY(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&gY.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function TY(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else wf(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else wf(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function xv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:hY;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i0?(fs(e,e.length,0,t),e):t}const gT={}.hasOwnProperty;function k3(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function di(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mr=ho(/[A-Za-z]/),_r=ho(/[\dA-Za-z]/),PY=ho(/[#-'*+\--9=?A-Z^-~]/);function Wm(e){return e!==null&&(e<32||e===127)}const TE=ho(/\d/),BY=ho(/[\dA-Fa-f]/),FY=ho(/[!-/:-@[-`{-~]/);function Je(e){return e!==null&&e<-2}function Qt(e){return e!==null&&(e<0||e===32)}function St(e){return e===-2||e===-1||e===32}const a0=ho(new RegExp("\\p{P}|\\p{S}","u")),sl=ho(/\s/);function ho(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fu(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Dt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return St(c)?(e.enter(n),o(c)):t(c)}function o(c){return St(c)&&i++a))return;const A=t.events.length;let S=A,C,R;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(C){R=t.events[S][1].end;break}C=!0}for(y(r),N=A;Nb;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function VY(e,t,n){return Dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hc(e){if(e===null||Qt(e)||sl(e))return 1;if(a0(e))return 2}function o0(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};bT(f,-c),bT(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Cs(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Cs(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=Cs(u,o0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Cs(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Cs(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,fs(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&St(N)?Dt(e,w,"linePrefix",i+1)(N):w(N)}function w(N){return N===null||Je(N)?e.check(ET,g,_)(N):(e.enter("codeFlowValue"),b(N))}function b(N){return N===null||Je(N)?(e.exit("codeFlowValue"),w(N)):(e.consume(N),b)}function _(N){return e.exit("codeFenced"),t(N)}function k(N,A,S){let C=0;return R;function R(D){return N.enter("lineEnding"),N.consume(D),N.exit("lineEnding"),O}function O(D){return N.enter("codeFencedFence"),St(D)?Dt(N,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):F(D)}function F(D){return D===o?(N.enter("codeFencedFenceSequence"),q(D)):S(D)}function q(D){return D===o?(C++,N.consume(D),q):C>=a?(N.exit("codeFencedFenceSequence"),St(D)?Dt(N,L,"whitespace")(D):L(D)):S(D)}function L(D){return D===null||Je(D)?(N.exit("codeFencedFence"),A(D)):S(D)}}}function nG(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Yy={name:"codeIndented",tokenize:sG},rG={partial:!0,tokenize:iG};function sG(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Dt(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):Je(u)?e.attempt(rG,a,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||Je(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function iG(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):Dt(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):Je(a)?s(a):n(a)}}const aG={name:"codeText",previous:lG,resolve:oG,tokenize:cG};function oG(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&zu(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),zu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),zu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function I3(e,t,n,r,s,i,a,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),h):y===null||y===32||y===41||Wm(y)?n(y):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(o),h(y)):y===null||y===60||Je(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function g(y){return!d&&(y===null||y===41||Qt(y))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Je(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Je(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!St(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function O3(e,t,n,r,s,i){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),c(a)):h===null?n(h):Je(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Dt(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Je(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function jd(e,t){let n;return r;function r(s){return Je(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):St(s)?Dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const yG={name:"definition",tokenize:EG},bG={partial:!0,tokenize:xG};function EG(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return R3.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return s=di(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Qt(p)?jd(e,u)(p):u(p)}function u(p){return I3(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(bG,f,f)(p)}function f(p){return St(p)?Dt(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Je(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function xG(e,t,n){return r;function r(o){return Qt(o)?jd(e,s)(o):n(o)}function s(o){return O3(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return St(o)?Dt(e,a,"whitespace")(o):a(o)}function a(o){return o===null||Je(o)?t(o):n(o)}}const wG={name:"hardBreakEscape",tokenize:vG};function vG(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Je(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const _G={name:"headingAtx",resolve:kG,tokenize:NG};function kG(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},fs(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function NG(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Qt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Je(d)?(e.exit("atxHeading"),t(d)):St(d)?Dt(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Qt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const SG=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wT=["pre","script","style","textarea"],TG={concrete:!0,name:"htmlFlow",resolveTo:IG,tokenize:RG},AG={partial:!0,tokenize:LG},CG={partial:!0,tokenize:OG};function IG(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function RG(e,t,n){const r=this;let s,i,a,o,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),i=!0,g):B===63?(e.consume(B),s=3,r.interrupt?t:I):Mr(B)?(e.consume(B),a=String.fromCharCode(B),x):n(B)}function h(B){return B===45?(e.consume(B),s=2,p):B===91?(e.consume(B),s=5,o=0,m):Mr(B)?(e.consume(B),s=4,r.interrupt?t:I):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:I):n(B)}function m(B){const ie="CDATA[";return B===ie.charCodeAt(o++)?(e.consume(B),o===ie.length?r.interrupt?t:F:m):n(B)}function g(B){return Mr(B)?(e.consume(B),a=String.fromCharCode(B),x):n(B)}function x(B){if(B===null||B===47||B===62||Qt(B)){const ie=B===47,Q=a.toLowerCase();return!ie&&!i&&wT.includes(Q)?(s=1,r.interrupt?t(B):F(B)):SG.includes(a.toLowerCase())?(s=6,ie?(e.consume(B),y):r.interrupt?t(B):F(B)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?w(B):b(B))}return B===45||_r(B)?(e.consume(B),a+=String.fromCharCode(B),x):n(B)}function y(B){return B===62?(e.consume(B),r.interrupt?t:F):n(B)}function w(B){return St(B)?(e.consume(B),w):R(B)}function b(B){return B===47?(e.consume(B),R):B===58||B===95||Mr(B)?(e.consume(B),_):St(B)?(e.consume(B),b):R(B)}function _(B){return B===45||B===46||B===58||B===95||_r(B)?(e.consume(B),_):k(B)}function k(B){return B===61?(e.consume(B),N):St(B)?(e.consume(B),k):b(B)}function N(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,A):St(B)?(e.consume(B),N):S(B)}function A(B){return B===c?(e.consume(B),c=null,C):B===null||Je(B)?n(B):(e.consume(B),A)}function S(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Qt(B)?k(B):(e.consume(B),S)}function C(B){return B===47||B===62||St(B)?b(B):n(B)}function R(B){return B===62?(e.consume(B),O):n(B)}function O(B){return B===null||Je(B)?F(B):St(B)?(e.consume(B),O):n(B)}function F(B){return B===45&&s===2?(e.consume(B),T):B===60&&s===1?(e.consume(B),M):B===62&&s===4?(e.consume(B),K):B===63&&s===3?(e.consume(B),I):B===93&&s===5?(e.consume(B),U):Je(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(AG,W,q)(B)):B===null||Je(B)?(e.exit("htmlFlowData"),q(B)):(e.consume(B),F)}function q(B){return e.check(CG,L,W)(B)}function L(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),D}function D(B){return B===null||Je(B)?q(B):(e.enter("htmlFlowData"),F(B))}function T(B){return B===45?(e.consume(B),I):F(B)}function M(B){return B===47?(e.consume(B),a="",j):F(B)}function j(B){if(B===62){const ie=a.toLowerCase();return wT.includes(ie)?(e.consume(B),K):F(B)}return Mr(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),j):F(B)}function U(B){return B===93?(e.consume(B),I):F(B)}function I(B){return B===62?(e.consume(B),K):B===45&&s===2?(e.consume(B),I):F(B)}function K(B){return B===null||Je(B)?(e.exit("htmlFlowData"),W(B)):(e.consume(B),K)}function W(B){return e.exit("htmlFlow"),t(B)}}function OG(e,t,n){const r=this;return s;function s(a){return Je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function LG(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Zf,t,n)}}const MG={name:"htmlText",tokenize:jG};function jG(e,t,n){const r=this;let s,i,a;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),k):I===63?(e.consume(I),b):Mr(I)?(e.consume(I),S):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,m):Mr(I)?(e.consume(I),w):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Je(I)?(a=f,M(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?T(I):I===45?h(I):f(I)}function m(I){const K="CDATA[";return I===K.charCodeAt(i++)?(e.consume(I),i===K.length?g:m):n(I)}function g(I){return I===null?n(I):I===93?(e.consume(I),x):Je(I)?(a=g,M(I)):(e.consume(I),g)}function x(I){return I===93?(e.consume(I),y):g(I)}function y(I){return I===62?T(I):I===93?(e.consume(I),y):g(I)}function w(I){return I===null||I===62?T(I):Je(I)?(a=w,M(I)):(e.consume(I),w)}function b(I){return I===null?n(I):I===63?(e.consume(I),_):Je(I)?(a=b,M(I)):(e.consume(I),b)}function _(I){return I===62?T(I):b(I)}function k(I){return Mr(I)?(e.consume(I),N):n(I)}function N(I){return I===45||_r(I)?(e.consume(I),N):A(I)}function A(I){return Je(I)?(a=A,M(I)):St(I)?(e.consume(I),A):T(I)}function S(I){return I===45||_r(I)?(e.consume(I),S):I===47||I===62||Qt(I)?C(I):n(I)}function C(I){return I===47?(e.consume(I),T):I===58||I===95||Mr(I)?(e.consume(I),R):Je(I)?(a=C,M(I)):St(I)?(e.consume(I),C):T(I)}function R(I){return I===45||I===46||I===58||I===95||_r(I)?(e.consume(I),R):O(I)}function O(I){return I===61?(e.consume(I),F):Je(I)?(a=O,M(I)):St(I)?(e.consume(I),O):C(I)}function F(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,q):Je(I)?(a=F,M(I)):St(I)?(e.consume(I),F):(e.consume(I),L)}function q(I){return I===s?(e.consume(I),s=void 0,D):I===null?n(I):Je(I)?(a=q,M(I)):(e.consume(I),q)}function L(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Qt(I)?C(I):(e.consume(I),L)}function D(I){return I===47||I===62||Qt(I)?C(I):n(I)}function T(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function M(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),j}function j(I){return St(I)?Dt(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):U(I)}function U(I){return e.enter("htmlTextData"),a(I)}}const _v={name:"labelEnd",resolveAll:FG,resolveTo:UG,tokenize:$G},DG={tokenize:HG},PG={tokenize:zG},BG={tokenize:VG};function FG(e){let t=-1;const n=[];for(;++t=3&&(u===null||Je(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),St(u)?Dt(e,o,"whitespace")(u):o(u))}}const Vr={continuation:{tokenize:eW},exit:nW,name:"list",tokenize:JG},QG={partial:!0,tokenize:rW},ZG={partial:!0,tokenize:tW};function JG(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:TE(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Xp,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return TE(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Zf,r.interrupt?n:d,e.attempt(QG,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return St(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function eW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Zf,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Dt(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!St(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ZG,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Dt(e,e.attempt(Vr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function tW(e,t,n){const r=this;return Dt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function nW(e){e.exit(this.containerState.type)}function rW(e,t,n){const r=this;return Dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!St(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const vT={name:"setextUnderline",resolveTo:sW,tokenize:iW};function sW(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function iW(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),St(u)?Dt(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Je(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const aW={tokenize:oW};function oW(e){const t=this,n=e.attempt(Zf,r,e.attempt(this.parser.constructs.flowInitial,s,Dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(fG,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const lW={resolveAll:M3()},cW=L3("string"),uW=L3("text");function L3(e){return{resolveAll:M3(e==="text"?dW:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function kW(e,t){let n=-1;const r=[];let s;for(;++n0){const qe=he.tokenStack[he.tokenStack.length-1];(qe[1]||kT).call(he,void 0,qe[0])}for(ne.position={start:Ta(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:Ta(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function PW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=du(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function UW(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $W(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function P3(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function HW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return P3(e,t);const s={src:du(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function zW(e,t){const n={src:du(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function VW(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function KW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return P3(e,t);const s={href:du(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function YW(e,t){const n={href:du(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function GW(e,t,n){const r=e.all(t),s=n?WW(n):B3(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o0){const qe=he.tokenStack[he.tokenStack.length-1];(qe[1]||kT).call(he,void 0,qe[0])}for(ne.position={start:Ta(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:Ta(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function BW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function FW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=fu(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function $W(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function P3(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function zW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return P3(e,t);const s={src:fu(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function VW(e,t){const n={src:fu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function KW(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function YW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return P3(e,t);const s={href:fu(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function GW(e,t){const n={href:fu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WW(e,t,n){const r=e.all(t),s=n?qW(n):B3(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function qW(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Bi(t.children[1]),c=i0(t.children[t.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function eq(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(TT(t.slice(s),s>0,!1)),i.join("")}function TT(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===NT||i===ST;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===NT||i===ST;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function rq(e,t){const n={type:"text",value:nq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function sq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const iq={blockquote:MW,break:jW,code:DW,delete:PW,emphasis:BW,footnoteReference:FW,heading:UW,html:$W,imageReference:HW,image:zW,inlineCode:VW,linkReference:KW,link:YW,listItem:GW,list:qW,paragraph:XW,root:QW,strong:ZW,table:JW,tableCell:tq,tableRow:eq,text:rq,thematicBreak:sq,toml:np,yaml:np,definition:np,footnoteDefinition:np};function np(){}const F3=-1,l0=0,jd=1,qm=2,kv=3,Nv=4,Sv=5,Tv=6,U3=7,$3=8,aq=typeof self=="object"?self:globalThis,AT=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new aq[e](t)},oq=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case l0:case F3:return n(a,s);case jd:{const o=n([],s);for(const c of a)o.push(r(c));return o}case qm:{const o=n({},s);for(const[c,u]of a)o[r(c)]=r(u);return o}case kv:return n(new Date(a),s);case Nv:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case Sv:{const o=n(new Map,s);for(const[c,u]of a)o.set(r(c),r(u));return o}case Tv:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case U3:{const{name:o,message:c}=a;return n(AT(o,c),s)}case $3:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(AT(i,a),s)};return r},CT=e=>oq(new Map,e)(0),Al="",{toString:lq}={},{keys:cq}=Object,zu=e=>{const t=typeof e;if(t!=="object"||!e)return[l0,t];const n=lq.call(e).slice(8,-1);switch(n){case"Array":return[jd,Al];case"Object":return[qm,Al];case"Date":return[kv,Al];case"RegExp":return[Nv,Al];case"Map":return[Sv,Al];case"Set":return[Tv,Al];case"DataView":return[jd,n]}return n.includes("Array")?[jd,n]:n.includes("Error")?[U3,n]:[qm,n]},rp=([e,t])=>e===l0&&(t==="function"||t==="symbol"),uq=(e,t,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=zu(a);switch(o){case l0:{let d=a;switch(c){case"bigint":o=$3,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([F3],a)}return s([o,d],a)}case jd:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([o,d],a);for(const h of a)d.push(i(h));return f}case qm:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=s([o,d],a);for(const h of cq(a))(e||!rp(zu(a[h])))&&d.push([i(h),i(a[h])]);return f}case kv:return s([o,a.toISOString()],a);case Nv:{const{source:d,flags:f}=a;return s([o,{source:d,flags:f}],a)}case Sv:{const d=[],f=s([o,d],a);for(const[h,p]of a)(e||!(rp(zu(h))||rp(zu(p))))&&d.push([i(h),i(p)]);return f}case Tv:{const d=[],f=s([o,d],a);for(const h of a)(e||!rp(zu(h)))&&d.push(i(h));return f}}const{message:u}=a;return s([o,{name:c,message:u}],a)};return i},IT=(e,{json:t,lossy:n}={})=>{const r=[];return uq(!(t||n),!!t,new Map,r)(e),r},Hc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?CT(IT(e,t)):structuredClone(e):(e,t)=>CT(IT(e,t));function dq(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function fq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||dq,r=e.options.footnoteBackLabel||fq,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const w=x.children[x.children.length-1];w&&w.type==="text"?w.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),o.push(y)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Hc(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function qW(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function XW(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=Bi(t.children[1]),c=i0(t.children[t.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function tq(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(TT(t.slice(s),s>0,!1)),i.join("")}function TT(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===NT||i===ST;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===NT||i===ST;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function sq(e,t){const n={type:"text",value:rq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function iq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const aq={blockquote:jW,break:DW,code:PW,delete:BW,emphasis:FW,footnoteReference:UW,heading:$W,html:HW,imageReference:zW,image:VW,inlineCode:KW,linkReference:YW,link:GW,listItem:WW,list:XW,paragraph:QW,root:ZW,strong:JW,table:eq,tableCell:nq,tableRow:tq,text:sq,thematicBreak:iq,toml:np,yaml:np,definition:np,footnoteDefinition:np};function np(){}const F3=-1,l0=0,Dd=1,qm=2,kv=3,Nv=4,Sv=5,Tv=6,U3=7,$3=8,oq=typeof self=="object"?self:globalThis,AT=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new oq[e](t)},lq=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case l0:case F3:return n(a,s);case Dd:{const o=n([],s);for(const c of a)o.push(r(c));return o}case qm:{const o=n({},s);for(const[c,u]of a)o[r(c)]=r(u);return o}case kv:return n(new Date(a),s);case Nv:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case Sv:{const o=n(new Map,s);for(const[c,u]of a)o.set(r(c),r(u));return o}case Tv:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case U3:{const{name:o,message:c}=a;return n(AT(o,c),s)}case $3:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(AT(i,a),s)};return r},CT=e=>lq(new Map,e)(0),Al="",{toString:cq}={},{keys:uq}=Object,Vu=e=>{const t=typeof e;if(t!=="object"||!e)return[l0,t];const n=cq.call(e).slice(8,-1);switch(n){case"Array":return[Dd,Al];case"Object":return[qm,Al];case"Date":return[kv,Al];case"RegExp":return[Nv,Al];case"Map":return[Sv,Al];case"Set":return[Tv,Al];case"DataView":return[Dd,n]}return n.includes("Array")?[Dd,n]:n.includes("Error")?[U3,n]:[qm,n]},rp=([e,t])=>e===l0&&(t==="function"||t==="symbol"),dq=(e,t,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=Vu(a);switch(o){case l0:{let d=a;switch(c){case"bigint":o=$3,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([F3],a)}return s([o,d],a)}case Dd:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([o,d],a);for(const h of a)d.push(i(h));return f}case qm:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=s([o,d],a);for(const h of uq(a))(e||!rp(Vu(a[h])))&&d.push([i(h),i(a[h])]);return f}case kv:return s([o,a.toISOString()],a);case Nv:{const{source:d,flags:f}=a;return s([o,{source:d,flags:f}],a)}case Sv:{const d=[],f=s([o,d],a);for(const[h,p]of a)(e||!(rp(Vu(h))||rp(Vu(p))))&&d.push([i(h),i(p)]);return f}case Tv:{const d=[],f=s([o,d],a);for(const h of a)(e||!rp(Vu(h)))&&d.push(i(h));return f}}const{message:u}=a;return s([o,{name:c,message:u}],a)};return i},IT=(e,{json:t,lossy:n}={})=>{const r=[];return dq(!(t||n),!!t,new Map,r)(e),r},zc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?CT(IT(e,t)):structuredClone(e):(e,t)=>CT(IT(e,t));function fq(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function hq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function pq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||fq,r=e.options.footnoteBackLabel||hq,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const w=x.children[x.children.length-1];w&&w.type==="text"?w.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...m)}else d.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),o.push(y)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...zc(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const Jf=function(e){if(e==null)return yq;if(typeof e=="function")return c0(e);if(typeof e=="object")return Array.isArray(e)?pq(e):mq(e);if(typeof e=="string")return gq(e);throw new Error("Expected function, string, or object as test")};function pq(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=H3,m,g,x;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=wq(n(c,d)),p[0]===CE))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==xq)for(g=(r?y.children.length:-1)+a,x=d.concat(y);g>-1&&g":""))+")"})}return h;function h(){let p=H3,m,g,x;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=vq(n(c,d)),p[0]===CE))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==wq)for(g=(r?y.children.length:-1)+a,x=d.concat(y);g>-1&&g0&&n.push({type:"text",value:` -`}),n}function RT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function OT(e,t){const n=_q(e,t),r=n.one(e,void 0),s=hq(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function Aq(e,t){return e&&"run"in e?async function(n,r){const s=OT(n,{file:r,...t});await e.run(s,r)}:function(n,r){return OT(n,{file:r,...e||t})}}function LT(e){if(e)throw e}var Qp=Object.prototype.hasOwnProperty,V3=Object.prototype.toString,MT=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,DT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):V3.call(t)==="[object Array]"},PT=function(t){if(!t||V3.call(t)!=="[object Object]")return!1;var n=Qp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Qp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Qp.call(t,s)},BT=function(t,n){MT&&n.name==="__proto__"?MT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},FT=function(t,n){if(n==="__proto__")if(Qp.call(t,n)){if(jT)return jT(t,n).value}else return;return t[n]},Cq=function e(){var t,n,r,s,i,a,o=arguments[0],c=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},c=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});ca.length;let c;o&&a.push(s);try{c=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return s(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const Si={basename:Oq,dirname:Lq,extname:Mq,join:jq,sep:"/"};function Oq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');th(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Lq(e){if(th(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Mq(e){th(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function jq(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Pq(e,t){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function th(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Bq={cwd:Fq};function Fq(){return"/"}function OE(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Uq(e){if(typeof e=="string")e=new URL(e);else if(!OE(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return $q(e)}function $q(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const g=r[h][1];RE(g)&&RE(p)&&(p=Wy(!0,g,p)),r[h]=[u,p,...m]}}}}const Kq=new Av().freeze();function Zy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function eb(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $T(e){if(!RE(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function HT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sp(e){return Yq(e)?e:new K3(e)}function Yq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gq(e){return typeof e=="string"||Wq(e)}function Wq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zT=[],VT={allowDangerousHtml:!0},Xq=/^(https?|ircs?|mailto|xmpp)$/i,Qq=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zq(e){const t=Jq(e),n=eX(e);return tX(t.runSync(t.parse(n),n),e)}function Jq(e){const t=e.rehypePlugins||zT,n=e.remarkPlugins||zT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...VT}:VT;return Kq().use(LW).use(n).use(Aq,r).use(t)}function eX(e){const t=e.children||"",n=new K3;return typeof t=="string"&&(n.value=t),n}function tX(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||nX;for(const d of Qq)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+qq+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),eh(e,u),gY(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in Ky)if(Object.hasOwn(Ky,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=Ky[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function nX(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Xq.test(e.slice(0,t))?e:""}function KT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function rX(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sX(e,t,n){const s=Jf((n||{}).ignore||[]),i=iX(t);let a=-1;for(;++a0?{type:"text",value:N}:void 0),N===!1?h.lastIndex=_+1:(m!==_&&w.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(N)?w.push(...N):N&&w.push(N),m=_+b[0].length,y=!0),!h.global)break;b=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=KT(e,"(");let i=KT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function Y3(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||sl(n)||a0(n))&&(!t||n!==47)}G3.peek=AX;function xX(){this.buffer()}function wX(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function vX(){this.buffer()}function _X(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=di(this.sliceSerialize(e)).toLowerCase(),n.label=t}function NX(e){this.exit(e)}function SX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=di(this.sliceSerialize(e)).toLowerCase(),n.label=t}function TX(e){this.exit(e)}function AX(){return"["}function G3(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function CX(){return{enter:{gfmFootnoteCallString:xX,gfmFootnoteCall:wX,gfmFootnoteDefinitionLabelString:vX,gfmFootnoteDefinition:_X},exit:{gfmFootnoteCallString:kX,gfmFootnoteCall:NX,gfmFootnoteDefinitionLabelString:SX,gfmFootnoteDefinition:TX}}}function IX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:G3},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` -`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?W3:RX))),u(),c}}function RX(e,t,n){return t===0?e:W3(e,t,n)}function W3(e,t,n){return(n?"":" ")+e}const OX=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];q3.peek=PX;function LX(){return{canContainEols:["delete"],enter:{strikethrough:jX},exit:{strikethrough:DX}}}function MX(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:OX}],handlers:{delete:q3}}}function jX(e){this.enter({type:"delete",children:[]},e)}function DX(e){this.exit(e)}function q3(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function PX(){return"~"}function BX(e){return e.length}function FX(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||BX,i=[],a=[],o=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=b)}g.push(w)}a[d]=g,o[d]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=w),p[f]=w),h[f]=b}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),HX);return s(),a}function HX(e,t,n){return">"+(n?"":" ")+e}function zX(e,t){return WT(e,t.inConstruct,!0)&&!WT(e,t.notInConstruct,!1)}function WT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function KX(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function YX(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function GX(e,t,n,r){const s=YX(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(KX(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,WX);return f(),h}const o=n.createTracker(r),c=s.repeat(Math.max(VX(i,s)+1,3)),u=n.enter("codeFenced");let d=o.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` +`}),n}function RT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function OT(e,t){const n=kq(e,t),r=n.one(e,void 0),s=pq(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Cq(e,t){return e&&"run"in e?async function(n,r){const s=OT(n,{file:r,...t});await e.run(s,r)}:function(n,r){return OT(n,{file:r,...e||t})}}function LT(e){if(e)throw e}var Qp=Object.prototype.hasOwnProperty,V3=Object.prototype.toString,MT=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,DT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):V3.call(t)==="[object Array]"},PT=function(t){if(!t||V3.call(t)!=="[object Object]")return!1;var n=Qp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Qp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Qp.call(t,s)},BT=function(t,n){MT&&n.name==="__proto__"?MT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},FT=function(t,n){if(n==="__proto__")if(Qp.call(t,n)){if(jT)return jT(t,n).value}else return;return t[n]},Iq=function e(){var t,n,r,s,i,a,o=arguments[0],c=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},c=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});ca.length;let c;o&&a.push(s);try{c=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return s(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const Si={basename:Lq,dirname:Mq,extname:jq,join:Dq,sep:"/"};function Lq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');th(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function Mq(e){if(th(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function jq(e){th(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function Dq(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Bq(e,t){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function th(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fq={cwd:Uq};function Uq(){return"/"}function OE(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $q(e){if(typeof e=="string")e=new URL(e);else if(!OE(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Hq(e)}function Hq(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...m]=d;const g=r[h][1];RE(g)&&RE(p)&&(p=Wy(!0,g,p)),r[h]=[u,p,...m]}}}}const Yq=new Av().freeze();function Zy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function eb(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $T(e){if(!RE(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function HT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function sp(e){return Gq(e)?e:new K3(e)}function Gq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Wq(e){return typeof e=="string"||qq(e)}function qq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zT=[],VT={allowDangerousHtml:!0},Qq=/^(https?|ircs?|mailto|xmpp)$/i,Zq=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jq(e){const t=eX(e),n=tX(e);return nX(t.runSync(t.parse(n),n),e)}function eX(e){const t=e.rehypePlugins||zT,n=e.remarkPlugins||zT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...VT}:VT;return Yq().use(MW).use(n).use(Cq,r).use(t)}function tX(e){const t=e.children||"",n=new K3;return typeof t=="string"&&(n.value=t),n}function nX(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||rX;for(const d of Zq)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Xq+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),eh(e,u),yY(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in Ky)if(Object.hasOwn(Ky,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],g=Ky[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function rX(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||Qq.test(e.slice(0,t))?e:""}function KT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function sX(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iX(e,t,n){const s=Jf((n||{}).ignore||[]),i=aX(t);let a=-1;for(;++a0?{type:"text",value:N}:void 0),N===!1?h.lastIndex=_+1:(m!==_&&w.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(N)?w.push(...N):N&&w.push(N),m=_+b[0].length,y=!0),!h.global)break;b=h.exec(u.value)}return y?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=KT(e,"(");let i=KT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function Y3(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||sl(n)||a0(n))&&(!t||n!==47)}G3.peek=CX;function wX(){this.buffer()}function vX(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _X(){this.buffer()}function kX(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function NX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=di(this.sliceSerialize(e)).toLowerCase(),n.label=t}function SX(e){this.exit(e)}function TX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=di(this.sliceSerialize(e)).toLowerCase(),n.label=t}function AX(e){this.exit(e)}function CX(){return"["}function G3(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function IX(){return{enter:{gfmFootnoteCallString:wX,gfmFootnoteCall:vX,gfmFootnoteDefinitionLabelString:_X,gfmFootnoteDefinition:kX},exit:{gfmFootnoteCallString:NX,gfmFootnoteCall:SX,gfmFootnoteDefinitionLabelString:TX,gfmFootnoteDefinition:AX}}}function RX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:G3},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` +`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?W3:OX))),u(),c}}function OX(e,t,n){return t===0?e:W3(e,t,n)}function W3(e,t,n){return(n?"":" ")+e}const LX=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];q3.peek=BX;function MX(){return{canContainEols:["delete"],enter:{strikethrough:DX},exit:{strikethrough:PX}}}function jX(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:LX}],handlers:{delete:q3}}}function DX(e){this.enter({type:"delete",children:[]},e)}function PX(e){this.exit(e)}function q3(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function BX(){return"~"}function FX(e){return e.length}function UX(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||FX,i=[],a=[],o=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=b)}g.push(w)}a[d]=g,o[d]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=w),p[f]=w),h[f]=b}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),zX);return s(),a}function zX(e,t,n){return">"+(n?"":" ")+e}function VX(e,t){return WT(e,t.inConstruct,!0)&&!WT(e,t.notInConstruct,!1)}function WT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function YX(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function GX(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function WX(e,t,n,r){const s=GX(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(YX(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,qX);return f(),h}const o=n.createTracker(r),c=s.repeat(Math.max(KX(i,s)+1,3)),u=n.enter("codeFenced");let d=o.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...o.current()})),f()}return d+=o.move(` `),i&&(d+=o.move(i+` -`)),d+=o.move(c),u(),d}function WX(e,t,n){return(n?"":" ")+e}function Cv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function qX(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),a(),u}function XX(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function vf(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Xm(e,t,n){const r=$c(e),s=$c(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Q3.peek=QX;function Q3(e,t,n,r){const s=XX(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Xm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=vf(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Xm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+vf(f));const p=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function QX(e,t,n){return n.options.emphasis||"*"}function ZX(e,t){let n=!1;return eh(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,CE}),!!((!e.depth||e.depth<3)&&wv(e)&&(t.options.setext||n))}function JX(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(ZX(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:` +`)),d+=o.move(c),u(),d}function qX(e,t,n){return(n?"":" ")+e}function Cv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function XX(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),a(),u}function QX(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function vf(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Xm(e,t,n){const r=Hc(e),s=Hc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Q3.peek=ZX;function Q3(e,t,n,r){const s=QX(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Xm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=vf(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Xm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+vf(f));const p=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function ZX(e,t,n){return n.options.emphasis||"*"}function JX(e,t){let n=!1;return eh(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,CE}),!!((!e.depth||e.depth<3)&&wv(e)&&(t.options.setext||n))}function eQ(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(JX(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:` `,after:` `});return f(),d(),h+` `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...i.current()});return/^[\t ]/.test(u)&&(u=vf(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),o(),u}Z3.peek=eQ;function Z3(e){return e.value||""}function eQ(){return"<"}J3.peek=tQ;function J3(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),u+=c.move(")"),a(),u}function tQ(){return"!"}ej.peek=nQ;function ej(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const u=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function nQ(){return"!"}tj.peek=rQ;function tj(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}rj.peek=sQ;function rj(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(nj(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),o(),u}function sQ(e,t,n){return nj(e,n)?"<":"["}sj.peek=iQ;function sj(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function iQ(){return"["}function Iv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function aQ(e){const t=Iv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function oQ(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ij(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function lQ(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?oQ(n):Iv(n);const o=e.ordered?a==="."?")":".":aQ(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ij(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function dQ(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const fQ=Jf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function hQ(e,t,n,r){return(e.children.some(function(a){return fQ(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function pQ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}aj.peek=mQ;function aj(e,t,n,r){const s=pQ(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Xm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=vf(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Xm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+vf(f));const p=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function mQ(e,t,n){return n.options.strong||"*"}function gQ(e,t,n,r){return n.safe(e.value,r)}function yQ(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function bQ(e,t,n){const r=(ij(n)+(n.options.ruleSpaces?" ":"")).repeat(yQ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const oj={blockquote:$X,break:qT,code:GX,definition:qX,emphasis:Q3,hardBreak:qT,heading:JX,html:Z3,image:J3,imageReference:ej,inlineCode:tj,link:rj,linkReference:sj,list:lQ,listItem:uQ,paragraph:dQ,root:hQ,strong:aj,text:gQ,thematicBreak:bQ};function EQ(){return{enter:{table:xQ,tableData:XT,tableHeader:XT,tableRow:vQ},exit:{codeText:_Q,table:wQ,tableData:sb,tableHeader:sb,tableRow:sb}}}function xQ(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function wQ(e){this.exit(e),this.data.inTable=void 0}function vQ(e){this.enter({type:"tableRow",children:[]},e)}function sb(e){this.exit(e)}function XT(e){this.enter({type:"tableCell",children:[]},e)}function _Q(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kQ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kQ(e,t){return t==="|"?t:e}function NQ(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...i.current()});return/^[\t ]/.test(u)&&(u=vf(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),o(),u}Z3.peek=tQ;function Z3(e){return e.value||""}function tQ(){return"<"}J3.peek=nQ;function J3(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),u+=c.move(")"),a(),u}function nQ(){return"!"}ej.peek=rQ;function ej(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const u=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function rQ(){return"!"}tj.peek=sQ;function tj(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}rj.peek=iQ;function rj(e,t,n,r){const s=Cv(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(nj(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),o(),u}function iQ(e,t,n){return nj(e,n)?"<":"["}sj.peek=aQ;function sj(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function aQ(){return"["}function Iv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function oQ(e){const t=Iv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lQ(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ij(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function cQ(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?lQ(n):Iv(n);const o=e.ordered?a==="."?")":".":oQ(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),ij(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function fQ(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const hQ=Jf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pQ(e,t,n,r){return(e.children.some(function(a){return hQ(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function mQ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}aj.peek=gQ;function aj(e,t,n,r){const s=mQ(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Xm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=vf(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Xm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+vf(f));const p=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function gQ(e,t,n){return n.options.strong||"*"}function yQ(e,t,n,r){return n.safe(e.value,r)}function bQ(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function EQ(e,t,n){const r=(ij(n)+(n.options.ruleSpaces?" ":"")).repeat(bQ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const oj={blockquote:HX,break:qT,code:WX,definition:XX,emphasis:Q3,hardBreak:qT,heading:eQ,html:Z3,image:J3,imageReference:ej,inlineCode:tj,link:rj,linkReference:sj,list:cQ,listItem:dQ,paragraph:fQ,root:pQ,strong:aj,text:yQ,thematicBreak:EQ};function xQ(){return{enter:{table:wQ,tableData:XT,tableHeader:XT,tableRow:_Q},exit:{codeText:kQ,table:vQ,tableData:sb,tableHeader:sb,tableRow:sb}}}function wQ(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function vQ(e){this.exit(e),this.data.inTable=void 0}function _Q(e){this.enter({type:"tableRow",children:[]},e)}function sb(e){this.exit(e)}function XT(e){this.enter({type:"tableCell",children:[]},e)}function kQ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,NQ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function NQ(e,t){return t==="|"?t:e}function SQ(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:c,tableRow:o}};function a(p,m,g,x){return u(d(p,g,x),p.align)}function o(p,m,g,x){const y=f(p,g,x),w=u([y]);return w.slice(0,w.indexOf(` -`))}function c(p,m,g,x){const y=g.enter("tableCell"),w=g.enter("phrasing"),b=g.containerPhrasing(p,{...x,before:i,after:i});return w(),y(),b}function u(p,m){return FX(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function d(p,m,g){const x=p.children;let y=-1;const w=[],b=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const zQ={tokenize:QQ,partial:!0};function VQ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:WQ,continuation:{tokenize:qQ},exit:XQ}},text:{91:{name:"gfmFootnoteCall",tokenize:GQ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:KQ,resolveTo:YQ}}}}function KQ(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const u=di(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function YQ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function GQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!a||f===null||f===91||Qt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(di(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Qt(f)||(a=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function WQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Qt(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=di(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Qt(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),Dt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function qQ(e,t,n){return e.check(Zf,t,e.attempt(zQ,t,n))}function XQ(e){e.exit("gfmFootnoteDefinition")}function QQ(e,t,n){const r=this;return Dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function ZQ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const x=a.exit("strikethroughSequenceTemporary"),y=$c(m);return x._open=!y||y===2&&!!g,x._close=!g||g===2&&!!y,o(m)}}}class JQ{constructor(){this.map=[]}add(t,n,r){eZ(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function eZ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const L=r.events[O][1].type;if(L==="lineEnding"||L==="linePrefix")O--;else break}const F=O>-1?r.events[O][1].type:null,q=F==="tableHead"||F==="tableRow"?N:c;return q===N&&r.parser.lazy[r.now().line]?n(R):q(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(a=!0,i+=1),d(R)}function d(R){return R===null?n(R):Je(R)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),p):n(R):St(R)?Dt(e,d,"whitespace")(R):(i+=1,a&&(a=!1,s+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(R)))}function f(R){return R===null||R===124||Qt(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?h:f)}function h(R){return R===92||R===124?(e.consume(R),f):f(R)}function p(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),a=!1,St(R)?Dt(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):m(R))}function m(R){return R===45||R===58?x(R):R===124?(a=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),g):k(R)}function g(R){return St(R)?Dt(e,x,"whitespace")(R):x(R)}function x(R){return R===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),y):R===45?(i+=1,y(R)):R===null||Je(R)?_(R):k(R)}function y(R){return R===45?(e.enter("tableDelimiterFiller"),w(R)):k(R)}function w(R){return R===45?(e.consume(R),w):R===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(R))}function b(R){return St(R)?Dt(e,_,"whitespace")(R):_(R)}function _(R){return R===124?m(R):R===null||Je(R)?!a||s!==i?k(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):k(R)}function k(R){return n(R)}function N(R){return e.enter("tableRow"),A(R)}function A(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),A):R===null||Je(R)?(e.exit("tableRow"),t(R)):St(R)?Dt(e,A,"whitespace")(R):(e.enter("data"),S(R))}function S(R){return R===null||R===124||Qt(R)?(e.exit("data"),A(R)):(e.consume(R),R===92?C:S)}function C(R){return R===92||R===124?(e.consume(R),S):S(R)}}function sZ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,u,d,f;const h=new JQ;for(;++nn[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},Dl(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function ZT(e,t,n,r,s){const i=[],a=Dl(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function Dl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const iZ={name:"tasklistCheck",tokenize:oZ};function aZ(){return{text:{91:iZ}}}function oZ(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Qt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return Je(c)?t(c):St(c)?e.check({tokenize:lZ},t,n)(c):n(c)}}function lZ(e,t,n){return Dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function cZ(e){return k3([MQ(),VQ(),ZQ(e),nZ(),aZ()])}const uZ={};function dZ(e){const t=this,n=e||uZ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(cZ(n)),i.push(IQ()),a.push(RQ(n))}const JT=function(e,t,n){const r=Jf(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` -`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function yj(e,t,n){return e.type==="element"?EZ(e,t,n):e.type==="text"?n.whitespace==="normal"?bj(e,n):xZ(e):[]}function EZ(e,t,n){const r=Ej(e,n),s=e.children||[];let i=-1,a=[];if(yZ(e))return a;let o,c;for(ME(e)||r2(e)&&JT(t,e,r2)?c=` -`:gZ(e)?(o=2,c=2):gj(e)&&(o=1,c=1);++i]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function TZ(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=SZ(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function xj(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(o);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],x=["true","false"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],k=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:x,built_in:[...w,...b,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,i,a,y,o,c,u,d,n]}}function AZ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",x={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:y.concat([{begin:/\(/,end:/\)/,keywords:x,contains:y.concat(["self"]),relevance:0}]),relevance:0},b={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:x,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:x}}}function CZ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function IZ(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:s.concat(i),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},x=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[x,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const RZ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),OZ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],LZ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],MZ=[...OZ,...LZ],jZ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),DZ=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),PZ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),BZ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function FZ(e){const t=e.regex,n=RZ(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+DZ.join("|")+")"},{begin:":(:)?("+PZ.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+BZ.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:jZ.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+MZ.join("|")+")\\b"}]}}function UZ(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function $Z(e){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"vj(e,t,n-1))}function zZ(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+vj("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,s2,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},s2,u]}}const i2="[A-Za-z$_][0-9A-Za-z$_]*",VZ=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],KZ=["true","false","null","undefined","NaN","Infinity"],_j=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],kj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Nj=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],YZ=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],GZ=[].concat(Nj,_j,kj);function Sj(e){const t=e.regex,n=(j,{after:U})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,U)=>{const I=j[0].length+j.index,K=j.input[I];if(K==="<"||K===","){U.ignoreMatch();return}K===">"&&(n(j,{after:I})||U.ignoreMatch());let W;const B=j.input.substring(I);if(W=B.match(/^\s*=/)){U.ignoreMatch();return}if((W=B.match(/^\s+extends\s+/))&&W.index===0){U.ignoreMatch();return}}},o={$pattern:i2,keyword:VZ,literal:KZ,built_in:GZ,"variable.language":YZ},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(w,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[..._j,...kj]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(j){return t.concat("(?!",j.join("|"),")")}const q={match:t.concat(/\b/,F([...Nj,"super","import"].map(j=>`${j}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,w,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},q,O,A,D,{match:/\$[(.]/}]}}function Tj(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Bl="[0-9](_*[0-9])*",lp=`\\.(${Bl})`,cp="[0-9a-fA-F](_*[0-9a-fA-F])*",WZ={className:"number",variants:[{begin:`(\\b(${Bl})((${lp})|\\.)?|(${lp}))[eE][+-]?(${Bl})[fFdD]?\\b`},{begin:`\\b(${Bl})((${lp})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${lp})[fFdD]?\\b`},{begin:`\\b(${Bl})[fFdD]\\b`},{begin:`\\b0[xX]((${cp})\\.?|(${cp})?\\.(${cp}))[pP][+-]?(${Bl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cp})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function qZ(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=WZ,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,c,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const XZ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),QZ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ZZ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],JZ=[...QZ,...ZZ],eJ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Aj=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Cj=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),tJ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),nJ=Aj.concat(Cj).sort().reverse();function rJ(e){const t=XZ(e),n=nJ,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",a=[],o=[],c=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},u=function(b,_,k){return{className:b,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:eJ.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+tJ.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},x={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+JZ.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Aj.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Cj.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},w={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,x,w,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function sJ(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Ij(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function iJ(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function aJ(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,i,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(g,x,y="\\1")=>{const w=y==="\\1"?y:t.concat(y,x);return t.concat(t.concat("(?:",g,")"),x,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,x,y)=>t.concat(t.concat("(?:",g,")"),x,/(?:\\.|[^\\\/])*?/,y,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function oJ(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(L,D)=>{D.data._beginMatch=L[1]||L[2]},"on:end":(L,D)=>{D.data._beginMatch!==L[1]&&D.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ -]`,m={scope:"string",variants:[d,u,f,h]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},x=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],_={keyword:y,literal:(L=>{const D=[];return L.forEach(T=>{D.push(T),T.toLowerCase()===T?D.push(T.toUpperCase()):D.push(T.toLowerCase())}),D})(x),built_in:w},k=L=>L.map(D=>D.replace(/\|\d+$/,"")),N={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(w).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},A=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},R={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[C,a,S,e.C_BLOCK_COMMENT_MODE,m,g,N]},O={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(y).join("\\b|"),"|",k(w).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[R]};R.contains.push(O);const F=[C,S,e.C_BLOCK_COMMENT_MODE,m,g,N],q={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:x,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:x,keyword:["new","array"]},contains:["self",...F]},...F,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:_,contains:[q,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},a,O,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},N,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:_,contains:["self",q,a,S,e.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,g]}}function lJ(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function cJ(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Oj(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},x={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",c,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,x,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,f]}]}}function uJ(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function dJ(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function fJ(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(r,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},o={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},N=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=N,g.contains=N;const R=[{begin:/^\s*=>/,starts:{end:"$",contains:N}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:N}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(R).concat(u).concat(N)}}function hJ(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:o,literal:c,built_in:u},illegal:""},i]}}const pJ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),mJ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],gJ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],yJ=[...mJ,...gJ],bJ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),EJ=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),xJ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),wJ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function vJ(e){const t=pJ(e),n=xJ,r=EJ,s="@[a-z-]+",i="and or not only",o={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+yJ.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+wJ.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:bJ.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function _J(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function kJ(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...c].filter(k=>!d.includes(k)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},x={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function w(k){return t.concat(/\b/,t.either(...k.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const b={scope:"keyword",match:w(h),relevance:0};function _(k,{exceptions:N,when:A}={}){const S=A;return N=N||[],k.map(C=>C.match(/\|\d+$/)||N.includes(C)?C:S(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:i,type:o,built_in:f},contains:[{scope:"type",match:w(a)},b,y,g,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,x]}}function Lj(e){return e?typeof e=="string"?e:e.source:null}function Vu(e){return Gt("(?=",e,")")}function Gt(...e){return e.map(n=>Lj(n)).join("")}function NJ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Rr(...e){return"("+(NJ(e).capture?"":"?:")+e.map(r=>Lj(r)).join("|")+")"}const Lv=e=>Gt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),SJ=["Protocol","Type"].map(Lv),a2=["init","self"].map(Lv),TJ=["Any","Self"],ib=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],o2=["false","nil","true"],AJ=["assignment","associativity","higherThan","left","lowerThan","none","right"],CJ=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],l2=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Mj=Rr(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),jj=Rr(Mj,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),ab=Gt(Mj,jj,"*"),Dj=Rr(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Qm=Rr(Dj,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ki=Gt(Dj,Qm,"*"),up=Gt(/[A-Z]/,Qm,"*"),IJ=["attached","autoclosure",Gt(/convention\(/,Rr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Gt(/objc\(/,ki,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],RJ=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function OJ(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,Rr(...SJ,...a2)],className:{2:"keyword"}},i={match:Gt(/\./,Rr(...ib)),relevance:0},a=ib.filter(Ie=>typeof Ie=="string").concat(["_|0"]),o=ib.filter(Ie=>typeof Ie!="string").concat(TJ).map(Lv),c={variants:[{className:"keyword",match:Rr(...o,...a2)}]},u={$pattern:Rr(/\b\w+/,/#\w+/),keyword:a.concat(CJ),literal:o2},d=[s,i,c],f={match:Gt(/\./,Rr(...l2)),relevance:0},h={className:"built_in",match:Gt(/\b/,Rr(...l2),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:ab},{match:`\\.(\\.|${jj})+`}]},x=[m,g],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(Ie="")=>({className:"subst",variants:[{match:Gt(/\\/,Ie,/[0\\tnr"']/)},{match:Gt(/\\/,Ie,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(Ie="")=>({className:"subst",match:Gt(/\\/,Ie,/[\t ]*(?:[\r\n]|\r\n)/)}),N=(Ie="")=>({className:"subst",label:"interpol",begin:Gt(/\\/,Ie,/\(/),end:/\)/}),A=(Ie="")=>({begin:Gt(Ie,/"""/),end:Gt(/"""/,Ie),contains:[_(Ie),k(Ie),N(Ie)]}),S=(Ie="")=>({begin:Gt(Ie,/"/),end:Gt(/"/,Ie),contains:[_(Ie),N(Ie)]}),C={className:"string",variants:[A(),A("#"),A("##"),A("###"),S(),S("#"),S("##"),S("###")]},R=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],O={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:R},F=Ie=>{const We=Gt(Ie,/\//),Ce=Gt(/\//,Ie);return{begin:We,end:Ce,contains:[...R,{scope:"comment",begin:`#(?!.*${Ce})`,end:/$/}]}},q={scope:"regexp",variants:[F("###"),F("##"),F("#"),O]},L={match:Gt(/`/,ki,/`/)},D={className:"variable",match:/\$\d+/},T={className:"variable",match:`\\$${Qm}+`},M=[L,D,T],j={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:RJ,contains:[...x,b,C]}]}},U={scope:"keyword",match:Gt(/@/,Rr(...IJ),Vu(Rr(/\(/,/\s+/)))},I={scope:"meta",match:Gt(/@/,ki)},K=[j,U,I],W={match:Vu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Gt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Qm,"+")},{className:"type",match:up,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Gt(/\s+&\s+/,Vu(up)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...K,m,W]};W.contains.push(B);const ie={match:Gt(ki,/\s*:/),keywords:"_|0",relevance:0},Q={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ie,...r,q,...d,...p,...x,b,C,...M,...K,W]},ee={begin://,keywords:"repeat each",contains:[...r,W]},ce={begin:Rr(Vu(Gt(ki,/\s*:/)),Vu(Gt(ki,/\s+/,ki,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ki}]},J={begin:/\(/,end:/\)/,keywords:u,contains:[ce,...r,...d,...x,b,C,...K,W,Q],endsParent:!0,illegal:/["']/},fe={match:[/(func|macro)/,/\s+/,Rr(L.match,ki,ab)],className:{1:"keyword",3:"title.function"},contains:[ee,J,t],illegal:[/\[/,/%/]},te={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ee,J,t],illegal:/\[|%/},ge={match:[/operator/,/\s+/,ab],className:{1:"keyword",3:"title"}},we={begin:[/precedencegroup/,/\s+/,up],className:{1:"keyword",3:"title"},contains:[W],keywords:[...AJ,...o2],end:/}/},Z={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ki,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[ee,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:up},...d],relevance:0}]};for(const Ie of C.variants){const We=Ie.contains.find(et=>et.label==="interpol");We.keywords=u;const Ce=[...d,...p,...x,b,C,...M];We.contains=[...Ce,{begin:/\(/,end:/\)/,contains:["self",...Ce]}]}return{name:"Swift",keywords:u,contains:[...r,fe,te,Z,me,Ne,ge,we,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},q,...d,...p,...x,b,C,...M,...K,W,Q]}}const Zm="[A-Za-z$_][0-9A-Za-z$_]*",Pj=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Bj=["true","false","null","undefined","NaN","Infinity"],Fj=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Uj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],$j=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Hj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zj=[].concat($j,Fj,Uj);function LJ(e){const t=e.regex,n=(j,{after:U})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,U)=>{const I=j[0].length+j.index,K=j.input[I];if(K==="<"||K===","){U.ignoreMatch();return}K===">"&&(n(j,{after:I})||U.ignoreMatch());let W;const B=j.input.substring(I);if(W=B.match(/^\s*=/)){U.ignoreMatch();return}if((W=B.match(/^\s+extends\s+/))&&W.index===0){U.ignoreMatch();return}}},o={$pattern:Zm,keyword:Pj,literal:Bj,built_in:zj,"variable.language":Hj},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(w,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Fj,...Uj]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(j){return t.concat("(?!",j.join("|"),")")}const q={match:t.concat(/\b/,F([...$j,"super","import"].map(j=>`${j}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,w,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},q,O,A,D,{match:/\$[(.]/}]}}function Vj(e){const t=e.regex,n=LJ(e),r=Zm,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Zm,keyword:Pj.concat(c),literal:Bj,built_in:zj.concat(s),"variable.language":Hj},d={className:"meta",begin:"@"+r},f=(g,x,y)=>{const w=g.contains.findIndex(b=>b.label===x);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,i,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function MJ(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(a,o),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function jJ(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,a,s,e.QUOTE_STRING_MODE,c,u,o]}}function DJ(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,c,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,a,c,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Kj(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},x=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,g,i,a],y=[...x];return y.pop(),y.push(o),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:x}}const PJ={arduino:TZ,bash:xj,c:AZ,cpp:CZ,csharp:IZ,css:FZ,diff:UZ,go:$Z,graphql:HZ,ini:wj,java:zZ,javascript:Sj,json:Tj,kotlin:qZ,less:rJ,lua:sJ,makefile:Ij,markdown:Rj,objectivec:iJ,perl:aJ,php:oJ,"php-template":lJ,plaintext:cJ,python:Oj,"python-repl":uJ,r:dJ,ruby:fJ,rust:hJ,scss:vJ,shell:_J,sql:kJ,swift:OJ,typescript:Vj,vbnet:MJ,wasm:jJ,xml:DJ,yaml:Kj};function Yj(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Yj(n)}),e}let c2=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Gj(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function za(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const BJ="",u2=e=>!!e.scope,FJ=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class UJ{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Gj(t)}openNode(t){if(!u2(t))return;const n=FJ(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){u2(t)&&(this.buffer+=BJ)}value(){return this.buffer}span(t){this.buffer+=``}}const d2=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Mv{constructor(){this.rootNode=d2(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=d2({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Mv._collapse(n)}))}}class $J extends Mv{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new UJ(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _f(e){return e?typeof e=="string"?e:e.source:null}function Wj(e){return gl("(?=",e,")")}function HJ(e){return gl("(?:",e,")*")}function zJ(e){return gl("(?:",e,")?")}function gl(...e){return e.map(n=>_f(n)).join("")}function VJ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function jv(...e){return"("+(VJ(e).capture?"":"?:")+e.map(r=>_f(r)).join("|")+")"}function qj(e){return new RegExp(e.toString()+"|").exec("").length-1}function KJ(e,t){const n=e&&e.exec(t);return n&&n.index===0}const YJ=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Dv(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=_f(r),a="";for(;i.length>0;){const o=YJ.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+s):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const GJ=/\b\B/,Xj="[a-zA-Z]\\w*",Pv="[a-zA-Z_]\\w*",Qj="\\b\\d+(\\.\\d+)?",Zj="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Jj="\\b(0b[01]+)",WJ="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",qJ=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=gl(t,/.*\b/,e.binary,/\b.*/)),za({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},kf={begin:"\\\\[\\s\\S]",relevance:0},XJ={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[kf]},QJ={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[kf]},ZJ={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},u0=function(e,t,n={}){const r=za({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=jv("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:gl(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},JJ=u0("//","$"),eee=u0("/\\*","\\*/"),tee=u0("#","$"),nee={scope:"number",begin:Qj,relevance:0},ree={scope:"number",begin:Zj,relevance:0},see={scope:"number",begin:Jj,relevance:0},iee={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[kf,{begin:/\[/,end:/\]/,relevance:0,contains:[kf]}]},aee={scope:"title",begin:Xj,relevance:0},oee={scope:"title",begin:Pv,relevance:0},lee={begin:"\\.\\s*"+Pv,relevance:0},cee=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var dp=Object.freeze({__proto__:null,APOS_STRING_MODE:XJ,BACKSLASH_ESCAPE:kf,BINARY_NUMBER_MODE:see,BINARY_NUMBER_RE:Jj,COMMENT:u0,C_BLOCK_COMMENT_MODE:eee,C_LINE_COMMENT_MODE:JJ,C_NUMBER_MODE:ree,C_NUMBER_RE:Zj,END_SAME_AS_BEGIN:cee,HASH_COMMENT_MODE:tee,IDENT_RE:Xj,MATCH_NOTHING_RE:GJ,METHOD_GUARD:lee,NUMBER_MODE:nee,NUMBER_RE:Qj,PHRASAL_WORDS_MODE:ZJ,QUOTE_STRING_MODE:QJ,REGEXP_MODE:iee,RE_STARTERS_RE:WJ,SHEBANG:qJ,TITLE_MODE:aee,UNDERSCORE_IDENT_RE:Pv,UNDERSCORE_TITLE_MODE:oee});function uee(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function dee(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function fee(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=uee,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function hee(e,t){Array.isArray(e.illegal)&&(e.illegal=jv(...e.illegal))}function pee(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function mee(e,t){e.relevance===void 0&&(e.relevance=1)}const gee=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=gl(n.beforeMatch,Wj(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},yee=["of","and","for","in","not","or","if","then","parent","list","value"],bee="keyword";function eD(e,t,n=bee){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,eD(e[i],t,i))}),r;function s(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const c=o.split("|");r[c[0]]=[i,Eee(c[0],c[1])]})}}function Eee(e,t){return t?Number(t):xee(e)?0:1}function xee(e){return yee.includes(e.toLowerCase())}const f2={},Yo=e=>{console.error(e)},h2=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Cl=(e,t)=>{f2[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),f2[`${e}/${t}`]=!0)},Jm=new Error;function tD(e,t,{key:n}){let r=0;const s=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+r]=s[o],i[o+r]=!0,r+=qj(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function wee(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Yo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Jm;if(typeof e.beginScope!="object"||e.beginScope===null)throw Yo("beginScope must be object"),Jm;tD(e,e.begin,{key:"beginScope"}),e.begin=Dv(e.begin,{joinWith:""})}}function vee(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Yo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Jm;if(typeof e.endScope!="object"||e.endScope===null)throw Yo("endScope must be object"),Jm;tD(e,e.end,{key:"endScope"}),e.end=Dv(e.end,{joinWith:""})}}function _ee(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function kee(e){_ee(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),wee(e),vee(e)}function Nee(e){function t(a,o){return new RegExp(_f(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,o]),this.matchAt+=qj(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(c=>c[1]);this.matcherRe=t(Dv(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(o);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const c=new n;return this.rules.slice(o).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[o]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,c){this.rules.push([o,c]),c.type==="begin"&&this.count++}exec(o){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function s(a){const o=new r;return a.contains.forEach(c=>o.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const c=a;if(a.isCompiled)return c;[dee,pee,kee,gee].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[fee,hee,mee].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=eD(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=_f(c.end)||"",a.endsWithParent&&o.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return See(d==="self"?a:d)})),a.contains.forEach(function(d){i(d,c)}),a.starts&&i(a.starts,o),c.matcher=s(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=za(e.classNameAliases||{}),i(e)}function nD(e){return e?e.endsWithParent||nD(e.starts):!1}function See(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return za(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:nD(e)?za(e,{starts:e.starts?za(e.starts):null}):Object.isFrozen(e)?za(e):e}var Tee="11.11.1";class Aee extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const ob=Gj,p2=za,m2=Symbol("nomatch"),Cee=7,rD=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:$J};function c(T){return o.noHighlightRe.test(T)}function u(T){let M=T.className+" ";M+=T.parentNode?T.parentNode.className:"";const j=o.languageDetectRe.exec(M);if(j){const U=S(j[1]);return U||(h2(i.replace("{}",j[1])),h2("Falling back to no-highlight mode for this block.",T)),U?j[1]:"no-highlight"}return M.split(/\s+/).find(U=>c(U)||S(U))}function d(T,M,j){let U="",I="";typeof M=="object"?(U=T,j=M.ignoreIllegals,I=M.language):(Cl("10.7.0","highlight(lang, code, ...args) has been deprecated."),Cl("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),I=T,U=M),j===void 0&&(j=!0);const K={code:U,language:I};L("before:highlight",K);const W=K.result?K.result:f(K.language,K.code,j);return W.code=K.code,L("after:highlight",W),W}function f(T,M,j,U){const I=Object.create(null);function K(X,ne){return X.keywords[ne]}function W(){if(!Ce.keywords){Ge.addText(Xe);return}let X=0;Ce.keywordPatternRe.lastIndex=0;let ne=Ce.keywordPatternRe.exec(Xe),he="";for(;ne;){he+=Xe.substring(X,ne.index);const Te=Ne.case_insensitive?ne[0].toLowerCase():ne[0],He=K(Ce,Te);if(He){const[qe,Ut]=He;if(Ge.addText(he),he="",I[Te]=(I[Te]||0)+1,I[Te]<=Cee&&(xt+=Ut),qe.startsWith("_"))he+=ne[0];else{const Ye=Ne.classNameAliases[qe]||qe;Q(ne[0],Ye)}}else he+=ne[0];X=Ce.keywordPatternRe.lastIndex,ne=Ce.keywordPatternRe.exec(Xe)}he+=Xe.substring(X),Ge.addText(he)}function B(){if(Xe==="")return;let X=null;if(typeof Ce.subLanguage=="string"){if(!t[Ce.subLanguage]){Ge.addText(Xe);return}X=f(Ce.subLanguage,Xe,!0,et[Ce.subLanguage]),et[Ce.subLanguage]=X._top}else X=p(Xe,Ce.subLanguage.length?Ce.subLanguage:null);Ce.relevance>0&&(xt+=X.relevance),Ge.__addSublanguage(X._emitter,X.language)}function ie(){Ce.subLanguage!=null?B():W(),Xe=""}function Q(X,ne){X!==""&&(Ge.startScope(ne),Ge.addText(X),Ge.endScope())}function ee(X,ne){let he=1;const Te=ne.length-1;for(;he<=Te;){if(!X._emit[he]){he++;continue}const He=Ne.classNameAliases[X[he]]||X[he],qe=ne[he];He?Q(qe,He):(Xe=qe,W(),Xe=""),he++}}function ce(X,ne){return X.scope&&typeof X.scope=="string"&&Ge.openNode(Ne.classNameAliases[X.scope]||X.scope),X.beginScope&&(X.beginScope._wrap?(Q(Xe,Ne.classNameAliases[X.beginScope._wrap]||X.beginScope._wrap),Xe=""):X.beginScope._multi&&(ee(X.beginScope,ne),Xe="")),Ce=Object.create(X,{parent:{value:Ce}}),Ce}function J(X,ne,he){let Te=KJ(X.endRe,he);if(Te){if(X["on:end"]){const He=new c2(X);X["on:end"](ne,He),He.isMatchIgnored&&(Te=!1)}if(Te){for(;X.endsParent&&X.parent;)X=X.parent;return X}}if(X.endsWithParent)return J(X.parent,ne,he)}function fe(X){return Ce.matcher.regexIndex===0?(Xe+=X[0],1):(ut=!0,0)}function te(X){const ne=X[0],he=X.rule,Te=new c2(he),He=[he.__beforeBegin,he["on:begin"]];for(const qe of He)if(qe&&(qe(X,Te),Te.isMatchIgnored))return fe(ne);return he.skip?Xe+=ne:(he.excludeBegin&&(Xe+=ne),ie(),!he.returnBegin&&!he.excludeBegin&&(Xe=ne)),ce(he,X),he.returnBegin?0:ne.length}function ge(X){const ne=X[0],he=M.substring(X.index),Te=J(Ce,X,he);if(!Te)return m2;const He=Ce;Ce.endScope&&Ce.endScope._wrap?(ie(),Q(ne,Ce.endScope._wrap)):Ce.endScope&&Ce.endScope._multi?(ie(),ee(Ce.endScope,X)):He.skip?Xe+=ne:(He.returnEnd||He.excludeEnd||(Xe+=ne),ie(),He.excludeEnd&&(Xe=ne));do Ce.scope&&Ge.closeNode(),!Ce.skip&&!Ce.subLanguage&&(xt+=Ce.relevance),Ce=Ce.parent;while(Ce!==Te.parent);return Te.starts&&ce(Te.starts,X),He.returnEnd?0:ne.length}function we(){const X=[];for(let ne=Ce;ne!==Ne;ne=ne.parent)ne.scope&&X.unshift(ne.scope);X.forEach(ne=>Ge.openNode(ne))}let Z={};function me(X,ne){const he=ne&&ne[0];if(Xe+=X,he==null)return ie(),0;if(Z.type==="begin"&&ne.type==="end"&&Z.index===ne.index&&he===""){if(Xe+=M.slice(ne.index,ne.index+1),!s){const Te=new Error(`0 width match regex (${T})`);throw Te.languageName=T,Te.badRule=Z.rule,Te}return 1}if(Z=ne,ne.type==="begin")return te(ne);if(ne.type==="illegal"&&!j){const Te=new Error('Illegal lexeme "'+he+'" for mode "'+(Ce.scope||"")+'"');throw Te.mode=Ce,Te}else if(ne.type==="end"){const Te=ge(ne);if(Te!==m2)return Te}if(ne.type==="illegal"&&he==="")return Xe+=` -`,1;if(At>1e5&&At>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=he,he.length}const Ne=S(T);if(!Ne)throw Yo(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Ie=Nee(Ne);let We="",Ce=U||Ie;const et={},Ge=new o.__emitter(o);we();let Xe="",xt=0,gt=0,At=0,ut=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(M,Ge);else{for(Ce.matcher.considerAll();;){At++,ut?ut=!1:Ce.matcher.considerAll(),Ce.matcher.lastIndex=gt;const X=Ce.matcher.exec(M);if(!X)break;const ne=M.substring(gt,X.index),he=me(ne,X);gt=X.index+he}me(M.substring(gt))}return Ge.finalize(),We=Ge.toHTML(),{language:T,value:We,relevance:xt,illegal:!1,_emitter:Ge,_top:Ce}}catch(X){if(X.message&&X.message.includes("Illegal"))return{language:T,value:ob(M),illegal:!0,relevance:0,_illegalBy:{message:X.message,index:gt,context:M.slice(gt-100,gt+100),mode:X.mode,resultSoFar:We},_emitter:Ge};if(s)return{language:T,value:ob(M),illegal:!1,relevance:0,errorRaised:X,_emitter:Ge,_top:Ce};throw X}}function h(T){const M={value:ob(T),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return M._emitter.addText(T),M}function p(T,M){M=M||o.languages||Object.keys(t);const j=h(T),U=M.filter(S).filter(R).map(ie=>f(ie,T,!1));U.unshift(j);const I=U.sort((ie,Q)=>{if(ie.relevance!==Q.relevance)return Q.relevance-ie.relevance;if(ie.language&&Q.language){if(S(ie.language).supersetOf===Q.language)return 1;if(S(Q.language).supersetOf===ie.language)return-1}return 0}),[K,W]=I,B=K;return B.secondBest=W,B}function m(T,M,j){const U=M&&n[M]||j;T.classList.add("hljs"),T.classList.add(`language-${U}`)}function g(T){let M=null;const j=u(T);if(c(j))return;if(L("before:highlightElement",{el:T,language:j}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(o.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(T)),o.throwUnescapedHTML))throw new Aee("One of your code blocks includes unescaped HTML.",T.innerHTML);M=T;const U=M.textContent,I=j?d(U,{language:j,ignoreIllegals:!0}):p(U);T.innerHTML=I.value,T.dataset.highlighted="yes",m(T,j,I.language),T.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(T.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),L("after:highlightElement",{el:T,result:I,text:U})}function x(T){o=p2(o,T)}const y=()=>{_(),Cl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){_(),Cl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function _(){function T(){_()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",T,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(g)}function k(T,M){let j=null;try{j=M(e)}catch(U){if(Yo("Language definition for '{}' could not be registered.".replace("{}",T)),s)Yo(U);else throw U;j=a}j.name||(j.name=T),t[T]=j,j.rawDefinition=M.bind(null,e),j.aliases&&C(j.aliases,{languageName:T})}function N(T){delete t[T];for(const M of Object.keys(n))n[M]===T&&delete n[M]}function A(){return Object.keys(t)}function S(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function C(T,{languageName:M}){typeof T=="string"&&(T=[T]),T.forEach(j=>{n[j.toLowerCase()]=M})}function R(T){const M=S(T);return M&&!M.disableAutodetect}function O(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=M=>{T["before:highlightBlock"](Object.assign({block:M.el},M))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=M=>{T["after:highlightBlock"](Object.assign({block:M.el},M))})}function F(T){O(T),r.push(T)}function q(T){const M=r.indexOf(T);M!==-1&&r.splice(M,1)}function L(T,M){const j=T;r.forEach(function(U){U[j]&&U[j](M)})}function D(T){return Cl("10.7.0","highlightBlock will be removed entirely in v12.0"),Cl("10.7.0","Please use highlightElement now."),g(T)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:g,highlightBlock:D,configure:x,initHighlighting:y,initHighlightingOnLoad:w,registerLanguage:k,unregisterLanguage:N,listLanguages:A,getLanguage:S,registerAliases:C,autoDetection:R,inherit:p2,addPlugin:F,removePlugin:q}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=Tee,e.regex={concat:gl,lookahead:Wj,either:jv,optional:zJ,anyNumberOfTimes:HJ};for(const T in dp)typeof dp[T]=="object"&&Yj(dp[T]);return Object.assign(e,dp),e},zc=rD({});zc.newInstance=()=>rD({});var Iee=zc;zc.HighlightJS=zc;zc.default=zc;const Qr=Bf(Iee),g2={},Ree="hljs-";function Oee(e){const t=Qr.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:a,registered:o};function n(c,u,d){const f=d||g2,h=typeof f.prefix=="string"?f.prefix:Ree;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:Lee,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(c,u){const f=(u||g2).subset||s();let h=-1,p=0,m;for(;++hp&&(p=x.data.relevance,m=x)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(c){return!!t.getLanguage(c)}}class Lee{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Mee={};function y2(e){const t=e||Mee,n=t.aliases,r=t.detect||!1,s=t.languages||PJ,i=t.plainText,a=t.prefix,o=t.subset;let c="hljs";const u=Oee(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){eh(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const g=jee(h);if(g===!1||!g&&!r||g&&i&&i.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const x=bZ(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,x,{prefix:a}):u.highlightAuto(x,{prefix:a,subset:o})}catch(w){const b=w;if(g&&/Unknown language/.test(b.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[m,h],cause:b,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw b}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function jee(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const c=x2(t,n[a-1]);o=c===-1?t.length+1:c+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length1?n[i.line-2]:0)+i.column-1;if(a=55296&&e<=57343}function ote(e){return e>=56320&&e<=57343}function lte(e,t){return(e-55296)*1024+9216+t}function cD(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function uD(e){return e>=64976&&e<=65007||ate.has(e)}var pe;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(pe||(pe={}));const cte=65536;class ute{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=cte,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(ote(n))return this.pos++,this._addGap(),lte(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,H.EOF;return this._err(pe.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;const r=this.html.charCodeAt(n);return r===H.CARRIAGE_RETURN?H.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;let t=this.html.charCodeAt(this.pos);return t===H.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,H.LINE_FEED):t===H.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,lD(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===H.LINE_FEED||t===H.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){cD(t)?this._err(pe.controlCharacterInInputStream):uD(t)&&this._err(pe.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const dte=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),fte=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function hte(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=fte.get(e))!==null&&t!==void 0?t:e}var sr;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(sr||(sr={}));const pte=32;var Va;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Va||(Va={}));function DE(e){return e>=sr.ZERO&&e<=sr.NINE}function mte(e){return e>=sr.UPPER_A&&e<=sr.UPPER_F||e>=sr.LOWER_A&&e<=sr.LOWER_F}function gte(e){return e>=sr.UPPER_A&&e<=sr.UPPER_Z||e>=sr.LOWER_A&&e<=sr.LOWER_Z||DE(e)}function yte(e){return e===sr.EQUALS||gte(e)}var nr;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(nr||(nr={}));var ea;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(ea||(ea={}));class bte{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=nr.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ea.Strict}startEntity(t){this.decodeMode=t,this.state=nr.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case nr.EntityStart:return t.charCodeAt(n)===sr.NUM?(this.state=nr.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=nr.NamedEntity,this.stateNamedEntity(t,n));case nr.NumericStart:return this.stateNumericStart(t,n);case nr.NumericDecimal:return this.stateNumericDecimal(t,n);case nr.NumericHex:return this.stateNumericHex(t,n);case nr.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|pte)===sr.LOWER_X?(this.state=nr.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=nr.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,i!==0){if(a===sr.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ea.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&Va.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Va.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case nr.NamedEntity:return this.result!==0&&(this.decodeMode!==ea.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case nr.NumericDecimal:return this.emitNumericEntity(0,2);case nr.NumericHex:return this.emitNumericEntity(0,3);case nr.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case nr.EntityStart:return 0}}}function Ete(e,t,n,r){const s=(t&Va.BRANCH_LENGTH)>>7,i=t&Va.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const c=r-i;return c<0||c>=s?-1:e[n+c]-1}let a=n,o=a+s-1;for(;a<=o;){const c=a+o>>>1,u=e[c];if(ur)o=c-1;else return e[c+s]}return-1}var ke;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ke||(ke={}));var Go;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Go||(Go={}));var Is;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Is||(Is={}));var se;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(se||(se={}));var v;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(v||(v={}));const xte=new Map([[se.A,v.A],[se.ADDRESS,v.ADDRESS],[se.ANNOTATION_XML,v.ANNOTATION_XML],[se.APPLET,v.APPLET],[se.AREA,v.AREA],[se.ARTICLE,v.ARTICLE],[se.ASIDE,v.ASIDE],[se.B,v.B],[se.BASE,v.BASE],[se.BASEFONT,v.BASEFONT],[se.BGSOUND,v.BGSOUND],[se.BIG,v.BIG],[se.BLOCKQUOTE,v.BLOCKQUOTE],[se.BODY,v.BODY],[se.BR,v.BR],[se.BUTTON,v.BUTTON],[se.CAPTION,v.CAPTION],[se.CENTER,v.CENTER],[se.CODE,v.CODE],[se.COL,v.COL],[se.COLGROUP,v.COLGROUP],[se.DD,v.DD],[se.DESC,v.DESC],[se.DETAILS,v.DETAILS],[se.DIALOG,v.DIALOG],[se.DIR,v.DIR],[se.DIV,v.DIV],[se.DL,v.DL],[se.DT,v.DT],[se.EM,v.EM],[se.EMBED,v.EMBED],[se.FIELDSET,v.FIELDSET],[se.FIGCAPTION,v.FIGCAPTION],[se.FIGURE,v.FIGURE],[se.FONT,v.FONT],[se.FOOTER,v.FOOTER],[se.FOREIGN_OBJECT,v.FOREIGN_OBJECT],[se.FORM,v.FORM],[se.FRAME,v.FRAME],[se.FRAMESET,v.FRAMESET],[se.H1,v.H1],[se.H2,v.H2],[se.H3,v.H3],[se.H4,v.H4],[se.H5,v.H5],[se.H6,v.H6],[se.HEAD,v.HEAD],[se.HEADER,v.HEADER],[se.HGROUP,v.HGROUP],[se.HR,v.HR],[se.HTML,v.HTML],[se.I,v.I],[se.IMG,v.IMG],[se.IMAGE,v.IMAGE],[se.INPUT,v.INPUT],[se.IFRAME,v.IFRAME],[se.KEYGEN,v.KEYGEN],[se.LABEL,v.LABEL],[se.LI,v.LI],[se.LINK,v.LINK],[se.LISTING,v.LISTING],[se.MAIN,v.MAIN],[se.MALIGNMARK,v.MALIGNMARK],[se.MARQUEE,v.MARQUEE],[se.MATH,v.MATH],[se.MENU,v.MENU],[se.META,v.META],[se.MGLYPH,v.MGLYPH],[se.MI,v.MI],[se.MO,v.MO],[se.MN,v.MN],[se.MS,v.MS],[se.MTEXT,v.MTEXT],[se.NAV,v.NAV],[se.NOBR,v.NOBR],[se.NOFRAMES,v.NOFRAMES],[se.NOEMBED,v.NOEMBED],[se.NOSCRIPT,v.NOSCRIPT],[se.OBJECT,v.OBJECT],[se.OL,v.OL],[se.OPTGROUP,v.OPTGROUP],[se.OPTION,v.OPTION],[se.P,v.P],[se.PARAM,v.PARAM],[se.PLAINTEXT,v.PLAINTEXT],[se.PRE,v.PRE],[se.RB,v.RB],[se.RP,v.RP],[se.RT,v.RT],[se.RTC,v.RTC],[se.RUBY,v.RUBY],[se.S,v.S],[se.SCRIPT,v.SCRIPT],[se.SEARCH,v.SEARCH],[se.SECTION,v.SECTION],[se.SELECT,v.SELECT],[se.SOURCE,v.SOURCE],[se.SMALL,v.SMALL],[se.SPAN,v.SPAN],[se.STRIKE,v.STRIKE],[se.STRONG,v.STRONG],[se.STYLE,v.STYLE],[se.SUB,v.SUB],[se.SUMMARY,v.SUMMARY],[se.SUP,v.SUP],[se.TABLE,v.TABLE],[se.TBODY,v.TBODY],[se.TEMPLATE,v.TEMPLATE],[se.TEXTAREA,v.TEXTAREA],[se.TFOOT,v.TFOOT],[se.TD,v.TD],[se.TH,v.TH],[se.THEAD,v.THEAD],[se.TITLE,v.TITLE],[se.TR,v.TR],[se.TRACK,v.TRACK],[se.TT,v.TT],[se.U,v.U],[se.UL,v.UL],[se.SVG,v.SVG],[se.VAR,v.VAR],[se.WBR,v.WBR],[se.XMP,v.XMP]]);function hu(e){var t;return(t=xte.get(e))!==null&&t!==void 0?t:v.UNKNOWN}const Ae=v,wte={[ke.HTML]:new Set([Ae.ADDRESS,Ae.APPLET,Ae.AREA,Ae.ARTICLE,Ae.ASIDE,Ae.BASE,Ae.BASEFONT,Ae.BGSOUND,Ae.BLOCKQUOTE,Ae.BODY,Ae.BR,Ae.BUTTON,Ae.CAPTION,Ae.CENTER,Ae.COL,Ae.COLGROUP,Ae.DD,Ae.DETAILS,Ae.DIR,Ae.DIV,Ae.DL,Ae.DT,Ae.EMBED,Ae.FIELDSET,Ae.FIGCAPTION,Ae.FIGURE,Ae.FOOTER,Ae.FORM,Ae.FRAME,Ae.FRAMESET,Ae.H1,Ae.H2,Ae.H3,Ae.H4,Ae.H5,Ae.H6,Ae.HEAD,Ae.HEADER,Ae.HGROUP,Ae.HR,Ae.HTML,Ae.IFRAME,Ae.IMG,Ae.INPUT,Ae.LI,Ae.LINK,Ae.LISTING,Ae.MAIN,Ae.MARQUEE,Ae.MENU,Ae.META,Ae.NAV,Ae.NOEMBED,Ae.NOFRAMES,Ae.NOSCRIPT,Ae.OBJECT,Ae.OL,Ae.P,Ae.PARAM,Ae.PLAINTEXT,Ae.PRE,Ae.SCRIPT,Ae.SECTION,Ae.SELECT,Ae.SOURCE,Ae.STYLE,Ae.SUMMARY,Ae.TABLE,Ae.TBODY,Ae.TD,Ae.TEMPLATE,Ae.TEXTAREA,Ae.TFOOT,Ae.TH,Ae.THEAD,Ae.TITLE,Ae.TR,Ae.TRACK,Ae.UL,Ae.WBR,Ae.XMP]),[ke.MATHML]:new Set([Ae.MI,Ae.MO,Ae.MN,Ae.MS,Ae.MTEXT,Ae.ANNOTATION_XML]),[ke.SVG]:new Set([Ae.TITLE,Ae.FOREIGN_OBJECT,Ae.DESC]),[ke.XLINK]:new Set,[ke.XML]:new Set,[ke.XMLNS]:new Set},PE=new Set([Ae.H1,Ae.H2,Ae.H3,Ae.H4,Ae.H5,Ae.H6]);se.STYLE,se.SCRIPT,se.XMP,se.IFRAME,se.NOEMBED,se.NOFRAMES,se.PLAINTEXT;var V;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(V||(V={}));const Pn={DATA:V.DATA,RCDATA:V.RCDATA,RAWTEXT:V.RAWTEXT,SCRIPT_DATA:V.SCRIPT_DATA,PLAINTEXT:V.PLAINTEXT,CDATA_SECTION:V.CDATA_SECTION};function vte(e){return e>=H.DIGIT_0&&e<=H.DIGIT_9}function cd(e){return e>=H.LATIN_CAPITAL_A&&e<=H.LATIN_CAPITAL_Z}function _te(e){return e>=H.LATIN_SMALL_A&&e<=H.LATIN_SMALL_Z}function Oa(e){return _te(e)||cd(e)}function v2(e){return Oa(e)||vte(e)}function fp(e){return e+32}function fD(e){return e===H.SPACE||e===H.LINE_FEED||e===H.TABULATION||e===H.FORM_FEED}function _2(e){return fD(e)||e===H.SOLIDUS||e===H.GREATER_THAN_SIGN}function kte(e){return e===H.NULL?pe.nullCharacterReference:e>1114111?pe.characterReferenceOutsideUnicodeRange:lD(e)?pe.surrogateCharacterReference:uD(e)?pe.noncharacterCharacterReference:cD(e)||e===H.CARRIAGE_RETURN?pe.controlCharacterReference:null}class Nte{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=V.DATA,this.returnState=V.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new ute(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new bte(dte,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(pe.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(pe.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=kte(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(pe.endTagWithAttributes),t.selfClosing&&this._err(pe.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Nt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Nt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Nt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Nt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=fD(t)?Nt.WHITESPACE_CHARACTER:t===H.NULL?Nt.NULL_CHARACTER:Nt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Nt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=V.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ea.Attribute:ea.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===V.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case V.DATA:{this._stateData(t);break}case V.RCDATA:{this._stateRcdata(t);break}case V.RAWTEXT:{this._stateRawtext(t);break}case V.SCRIPT_DATA:{this._stateScriptData(t);break}case V.PLAINTEXT:{this._statePlaintext(t);break}case V.TAG_OPEN:{this._stateTagOpen(t);break}case V.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case V.TAG_NAME:{this._stateTagName(t);break}case V.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case V.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case V.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case V.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case V.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case V.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case V.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case V.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case V.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case V.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case V.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case V.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case V.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case V.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case V.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case V.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case V.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case V.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case V.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case V.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case V.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case V.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case V.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case V.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case V.BOGUS_COMMENT:{this._stateBogusComment(t);break}case V.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case V.COMMENT_START:{this._stateCommentStart(t);break}case V.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case V.COMMENT:{this._stateComment(t);break}case V.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case V.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case V.COMMENT_END:{this._stateCommentEnd(t);break}case V.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case V.DOCTYPE:{this._stateDoctype(t);break}case V.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case V.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case V.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case V.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case V.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case V.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case V.CDATA_SECTION:{this._stateCdataSection(t);break}case V.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case V.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case V.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case V.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.TAG_OPEN;break}case H.AMPERSAND:{this._startCharacterReference();break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitCodePoint(t);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case H.AMPERSAND:{this._startCharacterReference();break}case H.LESS_THAN_SIGN:{this.state=V.RCDATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.RAWTEXT_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.SCRIPT_DATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Oa(t))this._createStartTagToken(),this.state=V.TAG_NAME,this._stateTagName(t);else switch(t){case H.EXCLAMATION_MARK:{this.state=V.MARKUP_DECLARATION_OPEN;break}case H.SOLIDUS:{this.state=V.END_TAG_OPEN;break}case H.QUESTION_MARK:{this._err(pe.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=V.BOGUS_COMMENT,this._stateBogusComment(t);break}case H.EOF:{this._err(pe.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(pe.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=V.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Oa(t))this._createEndTagToken(),this.state=V.TAG_NAME,this._stateTagName(t);else switch(t){case H.GREATER_THAN_SIGN:{this._err(pe.missingEndTagName),this.state=V.DATA;break}case H.EOF:{this._err(pe.eofBeforeTagName),this._emitChars("");break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars(mn);break}case H.EOF:{this._err(pe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===H.SOLIDUS?this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Oa(t)?(this._emitChars("<"),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Oa(t)?(this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(mn);break}case H.EOF:{this._err(pe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===H.SOLIDUS?(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(zr.SCRIPT,!1)&&_2(this.preprocessor.peek(zr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ke.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Ite,ke.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Cte,ke.HTML)}clearBackToTableRowContext(){this.clearBackTo(Ate,ke.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===v.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===v.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ke.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case ke.SVG:{if(S2.has(s))return!1;break}case ke.MATHML:{if(N2.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,eg)}hasInListItemScope(t){return this.hasInDynamicScope(t,Ste)}hasInButtonScope(t){return this.hasInDynamicScope(t,Tte)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ke.HTML:{if(PE.has(n))return!0;if(eg.has(n))return!1;break}case ke.SVG:{if(S2.has(n))return!1;break}case ke.MATHML:{if(N2.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ke.HTML)switch(this.tagIDs[n]){case t:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ke.HTML)switch(this.tagIDs[t]){case v.TBODY:case v.THEAD:case v.TFOOT:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ke.HTML)switch(this.tagIDs[n]){case t:return!0;case v.OPTION:case v.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&hD.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&k2.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&k2.has(this.currentTagId);)this.pop()}}const lb=3;var Ti;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ti||(Ti={}));const T2={type:Ti.Marker};class Lte{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let i=0;for(let a=0;as.get(c.name)===c.value)&&(i+=1,i>=lb&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(T2)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ti.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Ti.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(T2);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Ti.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Ti.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ti.Element&&n.element===t)}}const La={createDocument(){return{nodeName:"#document",mode:Is.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};La.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(La.isTextNode(n)){n.value+=t;return}}La.appendChild(e,La.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&La.isTextNode(r)?r.value+=t:La.insertBefore(e,La.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function Fte(e){return e.name===pD&&e.publicId===null&&(e.systemId===null||e.systemId===Mte)}function Ute(e){if(e.name!==pD)return Is.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===jte)return Is.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Pte.has(n))return Is.QUIRKS;let r=t===null?Dte:mD;if(A2(n,r))return Is.QUIRKS;if(r=t===null?gD:Bte,A2(n,r))return Is.LIMITED_QUIRKS}return Is.NO_QUIRKS}const C2={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},$te="definitionurl",Hte="definitionURL",zte=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Vte=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ke.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ke.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ke.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ke.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ke.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ke.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ke.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ke.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ke.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ke.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ke.XMLNS}]]),Kte=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Yte=new Set([v.B,v.BIG,v.BLOCKQUOTE,v.BODY,v.BR,v.CENTER,v.CODE,v.DD,v.DIV,v.DL,v.DT,v.EM,v.EMBED,v.H1,v.H2,v.H3,v.H4,v.H5,v.H6,v.HEAD,v.HR,v.I,v.IMG,v.LI,v.LISTING,v.MENU,v.META,v.NOBR,v.OL,v.P,v.PRE,v.RUBY,v.S,v.SMALL,v.SPAN,v.STRONG,v.STRIKE,v.SUB,v.SUP,v.TABLE,v.TT,v.U,v.UL,v.VAR]);function Gte(e){const t=e.tagID;return t===v.FONT&&e.attrs.some(({name:r})=>r===Go.COLOR||r===Go.SIZE||r===Go.FACE)||Yte.has(t)}function yD(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ke.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ke.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=G.TEXT}switchToPlaintextParsing(){this.insertionMode=G.TEXT,this.originalInsertionMode=G.IN_BODY,this.tokenizer.state=Pn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===se.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ke.HTML))switch(this.fragmentContextID){case v.TITLE:case v.TEXTAREA:{this.tokenizer.state=Pn.RCDATA;break}case v.STYLE:case v.XMP:case v.IFRAME:case v.NOEMBED:case v.NOFRAMES:case v.NOSCRIPT:{this.tokenizer.state=Pn.RAWTEXT;break}case v.SCRIPT:{this.tokenizer.state=Pn.SCRIPT_DATA;break}case v.PLAINTEXT:{this.tokenizer.state=Pn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ke.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ke.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(se.HTML,ke.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,v.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===Nt.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===v.SVG&&this.treeAdapter.getTagName(n)===se.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ke.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===v.MGLYPH||t.tagID===v.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ke.HTML)}_processToken(t){switch(t.type){case Nt.CHARACTER:{this.onCharacter(t);break}case Nt.NULL_CHARACTER:{this.onNullCharacter(t);break}case Nt.COMMENT:{this.onComment(t);break}case Nt.DOCTYPE:{this.onDoctype(t);break}case Nt.START_TAG:{this._processStartTag(t);break}case Nt.END_TAG:{this.onEndTag(t);break}case Nt.EOF:{this.onEof(t);break}case Nt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return Qte(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===Ti.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=G.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(v.P),this.openElements.popUntilTagNamePopped(v.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case v.TR:{this.insertionMode=G.IN_ROW;return}case v.TBODY:case v.THEAD:case v.TFOOT:{this.insertionMode=G.IN_TABLE_BODY;return}case v.CAPTION:{this.insertionMode=G.IN_CAPTION;return}case v.COLGROUP:{this.insertionMode=G.IN_COLUMN_GROUP;return}case v.TABLE:{this.insertionMode=G.IN_TABLE;return}case v.BODY:{this.insertionMode=G.IN_BODY;return}case v.FRAMESET:{this.insertionMode=G.IN_FRAMESET;return}case v.SELECT:{this._resetInsertionModeForSelect(t);return}case v.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case v.HTML:{this.insertionMode=this.headElement?G.AFTER_HEAD:G.BEFORE_HEAD;return}case v.TD:case v.TH:{if(t>0){this.insertionMode=G.IN_CELL;return}break}case v.HEAD:{if(t>0){this.insertionMode=G.IN_HEAD;return}break}}this.insertionMode=G.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===v.TEMPLATE)break;if(r===v.TABLE){this.insertionMode=G.IN_SELECT_IN_TABLE;return}}this.insertionMode=G.IN_SELECT}_isElementCausesFosterParenting(t){return ED.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case v.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ke.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case v.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return wte[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Rre(this,t);return}switch(this.insertionMode){case G.INITIAL:{Ku(this,t);break}case G.BEFORE_HTML:{Dd(this,t);break}case G.BEFORE_HEAD:{Pd(this,t);break}case G.IN_HEAD:{Bd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Fd(this,t);break}case G.AFTER_HEAD:{Ud(this,t);break}case G.IN_BODY:case G.IN_CAPTION:case G.IN_CELL:case G.IN_TEMPLATE:{wD(this,t);break}case G.TEXT:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_TABLE_TEXT:{TD(this,t);break}case G.IN_COLUMN_GROUP:{tg(this,t);break}case G.AFTER_BODY:{ng(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Ire(this,t);return}switch(this.insertionMode){case G.INITIAL:{Ku(this,t);break}case G.BEFORE_HTML:{Dd(this,t);break}case G.BEFORE_HEAD:{Pd(this,t);break}case G.IN_HEAD:{Bd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Fd(this,t);break}case G.AFTER_HEAD:{Ud(this,t);break}case G.TEXT:{this._insertCharacters(t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_COLUMN_GROUP:{tg(this,t);break}case G.AFTER_BODY:{ng(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){BE(this,t);return}switch(this.insertionMode){case G.INITIAL:case G.BEFORE_HTML:case G.BEFORE_HEAD:case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:case G.IN_BODY:case G.IN_TABLE:case G.IN_CAPTION:case G.IN_COLUMN_GROUP:case G.IN_TABLE_BODY:case G.IN_ROW:case G.IN_CELL:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:case G.IN_TEMPLATE:case G.IN_FRAMESET:case G.AFTER_FRAMESET:{BE(this,t);break}case G.IN_TABLE_TEXT:{Yu(this,t);break}case G.AFTER_BODY:{lne(this,t);break}case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{cne(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case G.INITIAL:{une(this,t);break}case G.BEFORE_HEAD:case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:{this._err(t,pe.misplacedDoctype);break}case G.IN_TABLE_TEXT:{Yu(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,pe.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Ore(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case G.INITIAL:{Ku(this,t);break}case G.BEFORE_HTML:{dne(this,t);break}case G.BEFORE_HEAD:{hne(this,t);break}case G.IN_HEAD:{mi(this,t);break}case G.IN_HEAD_NO_SCRIPT:{gne(this,t);break}case G.AFTER_HEAD:{bne(this,t);break}case G.IN_BODY:{Tr(this,t);break}case G.IN_TABLE:{Vc(this,t);break}case G.IN_TABLE_TEXT:{Yu(this,t);break}case G.IN_CAPTION:{pre(this,t);break}case G.IN_COLUMN_GROUP:{zv(this,t);break}case G.IN_TABLE_BODY:{h0(this,t);break}case G.IN_ROW:{p0(this,t);break}case G.IN_CELL:{yre(this,t);break}case G.IN_SELECT:{ID(this,t);break}case G.IN_SELECT_IN_TABLE:{Ere(this,t);break}case G.IN_TEMPLATE:{wre(this,t);break}case G.AFTER_BODY:{_re(this,t);break}case G.IN_FRAMESET:{kre(this,t);break}case G.AFTER_FRAMESET:{Sre(this,t);break}case G.AFTER_AFTER_BODY:{Are(this,t);break}case G.AFTER_AFTER_FRAMESET:{Cre(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Lre(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case G.INITIAL:{Ku(this,t);break}case G.BEFORE_HTML:{fne(this,t);break}case G.BEFORE_HEAD:{pne(this,t);break}case G.IN_HEAD:{mne(this,t);break}case G.IN_HEAD_NO_SCRIPT:{yne(this,t);break}case G.AFTER_HEAD:{Ene(this,t);break}case G.IN_BODY:{f0(this,t);break}case G.TEXT:{sre(this,t);break}case G.IN_TABLE:{Nf(this,t);break}case G.IN_TABLE_TEXT:{Yu(this,t);break}case G.IN_CAPTION:{mre(this,t);break}case G.IN_COLUMN_GROUP:{gre(this,t);break}case G.IN_TABLE_BODY:{FE(this,t);break}case G.IN_ROW:{CD(this,t);break}case G.IN_CELL:{bre(this,t);break}case G.IN_SELECT:{RD(this,t);break}case G.IN_SELECT_IN_TABLE:{xre(this,t);break}case G.IN_TEMPLATE:{vre(this,t);break}case G.AFTER_BODY:{LD(this,t);break}case G.IN_FRAMESET:{Nre(this,t);break}case G.AFTER_FRAMESET:{Tre(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onEof(t){switch(this.insertionMode){case G.INITIAL:{Ku(this,t);break}case G.BEFORE_HTML:{Dd(this,t);break}case G.BEFORE_HEAD:{Pd(this,t);break}case G.IN_HEAD:{Bd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Fd(this,t);break}case G.AFTER_HEAD:{Ud(this,t);break}case G.IN_BODY:case G.IN_TABLE:case G.IN_CAPTION:case G.IN_COLUMN_GROUP:case G.IN_TABLE_BODY:case G.IN_ROW:case G.IN_CELL:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:{ND(this,t);break}case G.TEXT:{ire(this,t);break}case G.IN_TABLE_TEXT:{Yu(this,t);break}case G.IN_TEMPLATE:{OD(this,t);break}case G.AFTER_BODY:case G.IN_FRAMESET:case G.AFTER_FRAMESET:case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{Hv(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===H.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:case G.TEXT:case G.IN_COLUMN_GROUP:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:case G.IN_FRAMESET:case G.AFTER_FRAMESET:{this._insertCharacters(t);break}case G.IN_BODY:case G.IN_CAPTION:case G.IN_CELL:case G.IN_TEMPLATE:case G.AFTER_BODY:case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{xD(this,t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_TABLE_TEXT:{SD(this,t);break}}}};function nne(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):kD(e,t),n}function rne(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function sne(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),c=o&&i>=ene;!o||c?(c&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=ine(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function ine(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function ane(e,t,n){const r=e.treeAdapter.getTagName(t),s=hu(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===v.TEMPLATE&&i===ke.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function one(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function $v(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function une(e,t){e._setDocumentType(t);const n=t.forceQuirks?Is.QUIRKS:Ute(t);Fte(t)||e._err(t,pe.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=G.BEFORE_HTML}function Ku(e,t){e._err(t,pe.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Is.QUIRKS),e.insertionMode=G.BEFORE_HTML,e._processToken(t)}function dne(e,t){t.tagID===v.HTML?(e._insertElement(t,ke.HTML),e.insertionMode=G.BEFORE_HEAD):Dd(e,t)}function fne(e,t){const n=t.tagID;(n===v.HTML||n===v.HEAD||n===v.BODY||n===v.BR)&&Dd(e,t)}function Dd(e,t){e._insertFakeRootElement(),e.insertionMode=G.BEFORE_HEAD,e._processToken(t)}function hne(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.HEAD:{e._insertElement(t,ke.HTML),e.headElement=e.openElements.current,e.insertionMode=G.IN_HEAD;break}default:Pd(e,t)}}function pne(e,t){const n=t.tagID;n===v.HEAD||n===v.BODY||n===v.HTML||n===v.BR?Pd(e,t):e._err(t,pe.endTagWithoutMatchingOpenElement)}function Pd(e,t){e._insertFakeElement(se.HEAD,v.HEAD),e.headElement=e.openElements.current,e.insertionMode=G.IN_HEAD,e._processToken(t)}function mi(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:{e._appendElement(t,ke.HTML),t.ackSelfClosing=!0;break}case v.TITLE:{e._switchToTextParsing(t,Pn.RCDATA);break}case v.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Pn.RAWTEXT):(e._insertElement(t,ke.HTML),e.insertionMode=G.IN_HEAD_NO_SCRIPT);break}case v.NOFRAMES:case v.STYLE:{e._switchToTextParsing(t,Pn.RAWTEXT);break}case v.SCRIPT:{e._switchToTextParsing(t,Pn.SCRIPT_DATA);break}case v.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=G.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(G.IN_TEMPLATE);break}case v.HEAD:{e._err(t,pe.misplacedStartTagForHeadElement);break}default:Bd(e,t)}}function mne(e,t){switch(t.tagID){case v.HEAD:{e.openElements.pop(),e.insertionMode=G.AFTER_HEAD;break}case v.BODY:case v.BR:case v.HTML:{Bd(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function yl(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==v.TEMPLATE&&e._err(t,pe.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,pe.endTagWithoutMatchingOpenElement)}function Bd(e,t){e.openElements.pop(),e.insertionMode=G.AFTER_HEAD,e._processToken(t)}function gne(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BASEFONT:case v.BGSOUND:case v.HEAD:case v.LINK:case v.META:case v.NOFRAMES:case v.STYLE:{mi(e,t);break}case v.NOSCRIPT:{e._err(t,pe.nestedNoscriptInHead);break}default:Fd(e,t)}}function yne(e,t){switch(t.tagID){case v.NOSCRIPT:{e.openElements.pop(),e.insertionMode=G.IN_HEAD;break}case v.BR:{Fd(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function Fd(e,t){const n=t.type===Nt.EOF?pe.openElementsLeftAfterEof:pe.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=G.IN_HEAD,e._processToken(t)}function bne(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BODY:{e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=G.IN_BODY;break}case v.FRAMESET:{e._insertElement(t,ke.HTML),e.insertionMode=G.IN_FRAMESET;break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{e._err(t,pe.abandonedHeadElementChild),e.openElements.push(e.headElement,v.HEAD),mi(e,t),e.openElements.remove(e.headElement);break}case v.HEAD:{e._err(t,pe.misplacedStartTagForHeadElement);break}default:Ud(e,t)}}function Ene(e,t){switch(t.tagID){case v.BODY:case v.HTML:case v.BR:{Ud(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function Ud(e,t){e._insertFakeElement(se.BODY,v.BODY),e.insertionMode=G.IN_BODY,d0(e,t)}function d0(e,t){switch(t.type){case Nt.CHARACTER:{wD(e,t);break}case Nt.WHITESPACE_CHARACTER:{xD(e,t);break}case Nt.COMMENT:{BE(e,t);break}case Nt.START_TAG:{Tr(e,t);break}case Nt.END_TAG:{f0(e,t);break}case Nt.EOF:{ND(e,t);break}}}function xD(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function wD(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function xne(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function wne(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function vne(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_FRAMESET)}function _ne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML)}function kne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&PE.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ke.HTML)}function Nne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Sne(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),n||(e.formElement=e.openElements.current))}function Tne(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===v.LI&&s===v.LI||(n===v.DD||n===v.DT)&&(s===v.DD||s===v.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==v.ADDRESS&&s!==v.DIV&&s!==v.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML)}function Ane(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.tokenizer.state=Pn.PLAINTEXT}function Cne(e,t){e.openElements.hasInScope(v.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(v.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.framesetOk=!1}function Ine(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(se.A);n&&($v(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Rne(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function One(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(v.NOBR)&&($v(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Lne(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Mne(e,t){e.treeAdapter.getDocumentMode(e.document)!==Is.QUIRKS&&e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=G.IN_TABLE}function vD(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ke.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function _D(e){const t=dD(e,Go.TYPE);return t!=null&&t.toLowerCase()===Zte}function jne(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ke.HTML),_D(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Dne(e,t){e._appendElement(t,ke.HTML),t.ackSelfClosing=!0}function Pne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._appendElement(t,ke.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Bne(e,t){t.tagName=se.IMG,t.tagID=v.IMG,vD(e,t)}function Fne(e,t){e._insertElement(t,ke.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Pn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=G.TEXT}function Une(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Pn.RAWTEXT)}function $ne(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Pn.RAWTEXT)}function O2(e,t){e._switchToTextParsing(t,Pn.RAWTEXT)}function Hne(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===G.IN_TABLE||e.insertionMode===G.IN_CAPTION||e.insertionMode===G.IN_TABLE_BODY||e.insertionMode===G.IN_ROW||e.insertionMode===G.IN_CELL?G.IN_SELECT_IN_TABLE:G.IN_SELECT}function zne(e,t){e.openElements.currentTagId===v.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML)}function Vne(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ke.HTML)}function Kne(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(v.RTC),e._insertElement(t,ke.HTML)}function Yne(e,t){e._reconstructActiveFormattingElements(),yD(t),Uv(t),t.selfClosing?e._appendElement(t,ke.MATHML):e._insertElement(t,ke.MATHML),t.ackSelfClosing=!0}function Gne(e,t){e._reconstructActiveFormattingElements(),bD(t),Uv(t),t.selfClosing?e._appendElement(t,ke.SVG):e._insertElement(t,ke.SVG),t.ackSelfClosing=!0}function L2(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML)}function Tr(e,t){switch(t.tagID){case v.I:case v.S:case v.B:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.SMALL:case v.STRIKE:case v.STRONG:{Rne(e,t);break}case v.A:{Ine(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{kne(e,t);break}case v.P:case v.DL:case v.OL:case v.UL:case v.DIV:case v.DIR:case v.NAV:case v.MAIN:case v.MENU:case v.ASIDE:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.DETAILS:case v.ADDRESS:case v.ARTICLE:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{_ne(e,t);break}case v.LI:case v.DD:case v.DT:{Tne(e,t);break}case v.BR:case v.IMG:case v.WBR:case v.AREA:case v.EMBED:case v.KEYGEN:{vD(e,t);break}case v.HR:{Pne(e,t);break}case v.RB:case v.RTC:{Vne(e,t);break}case v.RT:case v.RP:{Kne(e,t);break}case v.PRE:case v.LISTING:{Nne(e,t);break}case v.XMP:{Une(e,t);break}case v.SVG:{Gne(e,t);break}case v.HTML:{xne(e,t);break}case v.BASE:case v.LINK:case v.META:case v.STYLE:case v.TITLE:case v.SCRIPT:case v.BGSOUND:case v.BASEFONT:case v.TEMPLATE:{mi(e,t);break}case v.BODY:{wne(e,t);break}case v.FORM:{Sne(e,t);break}case v.NOBR:{One(e,t);break}case v.MATH:{Yne(e,t);break}case v.TABLE:{Mne(e,t);break}case v.INPUT:{jne(e,t);break}case v.PARAM:case v.TRACK:case v.SOURCE:{Dne(e,t);break}case v.IMAGE:{Bne(e,t);break}case v.BUTTON:{Cne(e,t);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{Lne(e,t);break}case v.IFRAME:{$ne(e,t);break}case v.SELECT:{Hne(e,t);break}case v.OPTION:case v.OPTGROUP:{zne(e,t);break}case v.NOEMBED:case v.NOFRAMES:{O2(e,t);break}case v.FRAMESET:{vne(e,t);break}case v.TEXTAREA:{Fne(e,t);break}case v.NOSCRIPT:{e.options.scriptingEnabled?O2(e,t):L2(e,t);break}case v.PLAINTEXT:{Ane(e,t);break}case v.COL:case v.TH:case v.TD:case v.TR:case v.HEAD:case v.FRAME:case v.TBODY:case v.TFOOT:case v.THEAD:case v.CAPTION:case v.COLGROUP:break;default:L2(e,t)}}function Wne(e,t){if(e.openElements.hasInScope(v.BODY)&&(e.insertionMode=G.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function qne(e,t){e.openElements.hasInScope(v.BODY)&&(e.insertionMode=G.AFTER_BODY,LD(e,t))}function Xne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Qne(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(v.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(v.FORM):n&&e.openElements.remove(n))}function Zne(e){e.openElements.hasInButtonScope(v.P)||e._insertFakeElement(se.P,v.P),e._closePElement()}function Jne(e){e.openElements.hasInListItemScope(v.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(v.LI),e.openElements.popUntilTagNamePopped(v.LI))}function ere(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function tre(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function nre(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function rre(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(se.BR,v.BR),e.openElements.pop(),e.framesetOk=!1}function kD(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==v.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function f0(e,t){switch(t.tagID){case v.A:case v.B:case v.I:case v.S:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.NOBR:case v.SMALL:case v.STRIKE:case v.STRONG:{$v(e,t);break}case v.P:{Zne(e);break}case v.DL:case v.UL:case v.OL:case v.DIR:case v.DIV:case v.NAV:case v.PRE:case v.MAIN:case v.MENU:case v.ASIDE:case v.BUTTON:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.ADDRESS:case v.ARTICLE:case v.DETAILS:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.LISTING:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{Xne(e,t);break}case v.LI:{Jne(e);break}case v.DD:case v.DT:{ere(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{tre(e);break}case v.BR:{rre(e);break}case v.BODY:{Wne(e,t);break}case v.HTML:{qne(e,t);break}case v.FORM:{Qne(e);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{nre(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:kD(e,t)}}function ND(e,t){e.tmplInsertionModeStack.length>0?OD(e,t):Hv(e,t)}function sre(e,t){var n;t.tagID===v.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function ire(e,t){e._err(t,pe.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function cb(e,t){if(e.openElements.currentTagId!==void 0&&ED.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=G.IN_TABLE_TEXT,t.type){case Nt.CHARACTER:{TD(e,t);break}case Nt.WHITESPACE_CHARACTER:{SD(e,t);break}}else nh(e,t)}function are(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_CAPTION}function ore(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_COLUMN_GROUP}function lre(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.COLGROUP,v.COLGROUP),e.insertionMode=G.IN_COLUMN_GROUP,zv(e,t)}function cre(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_TABLE_BODY}function ure(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.TBODY,v.TBODY),e.insertionMode=G.IN_TABLE_BODY,h0(e,t)}function dre(e,t){e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function fre(e,t){_D(t)?e._appendElement(t,ke.HTML):nh(e,t),t.ackSelfClosing=!0}function hre(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ke.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Vc(e,t){switch(t.tagID){case v.TD:case v.TH:case v.TR:{ure(e,t);break}case v.STYLE:case v.SCRIPT:case v.TEMPLATE:{mi(e,t);break}case v.COL:{lre(e,t);break}case v.FORM:{hre(e,t);break}case v.TABLE:{dre(e,t);break}case v.TBODY:case v.TFOOT:case v.THEAD:{cre(e,t);break}case v.INPUT:{fre(e,t);break}case v.CAPTION:{are(e,t);break}case v.COLGROUP:{ore(e,t);break}default:nh(e,t)}}function Nf(e,t){switch(t.tagID){case v.TABLE:{e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode());break}case v.TEMPLATE:{yl(e,t);break}case v.BODY:case v.CAPTION:case v.COL:case v.COLGROUP:case v.HTML:case v.TBODY:case v.TD:case v.TFOOT:case v.TH:case v.THEAD:case v.TR:break;default:nh(e,t)}}function nh(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,d0(e,t),e.fosterParentingEnabled=n}function SD(e,t){e.pendingCharacterTokens.push(t)}function TD(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Yu(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===v.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===v.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===v.OPTGROUP&&e.openElements.pop();break}case v.OPTION:{e.openElements.currentTagId===v.OPTION&&e.openElements.pop();break}case v.SELECT:{e.openElements.hasInSelectScope(v.SELECT)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode());break}case v.TEMPLATE:{yl(e,t);break}}}function Ere(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ID(e,t)}function xre(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e.onEndTag(t)):RD(e,t)}function wre(e,t){switch(t.tagID){case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{mi(e,t);break}case v.CAPTION:case v.COLGROUP:case v.TBODY:case v.TFOOT:case v.THEAD:{e.tmplInsertionModeStack[0]=G.IN_TABLE,e.insertionMode=G.IN_TABLE,Vc(e,t);break}case v.COL:{e.tmplInsertionModeStack[0]=G.IN_COLUMN_GROUP,e.insertionMode=G.IN_COLUMN_GROUP,zv(e,t);break}case v.TR:{e.tmplInsertionModeStack[0]=G.IN_TABLE_BODY,e.insertionMode=G.IN_TABLE_BODY,h0(e,t);break}case v.TD:case v.TH:{e.tmplInsertionModeStack[0]=G.IN_ROW,e.insertionMode=G.IN_ROW,p0(e,t);break}default:e.tmplInsertionModeStack[0]=G.IN_BODY,e.insertionMode=G.IN_BODY,Tr(e,t)}}function vre(e,t){t.tagID===v.TEMPLATE&&yl(e,t)}function OD(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Hv(e,t)}function _re(e,t){t.tagID===v.HTML?Tr(e,t):ng(e,t)}function LD(e,t){var n;if(t.tagID===v.HTML){if(e.fragmentContext||(e.insertionMode=G.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===v.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else ng(e,t)}function ng(e,t){e.insertionMode=G.IN_BODY,d0(e,t)}function kre(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.FRAMESET:{e._insertElement(t,ke.HTML);break}case v.FRAME:{e._appendElement(t,ke.HTML),t.ackSelfClosing=!0;break}case v.NOFRAMES:{mi(e,t);break}}}function Nre(e,t){t.tagID===v.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==v.FRAMESET&&(e.insertionMode=G.AFTER_FRAMESET))}function Sre(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.NOFRAMES:{mi(e,t);break}}}function Tre(e,t){t.tagID===v.HTML&&(e.insertionMode=G.AFTER_AFTER_FRAMESET)}function Are(e,t){t.tagID===v.HTML?Tr(e,t):Jp(e,t)}function Jp(e,t){e.insertionMode=G.IN_BODY,d0(e,t)}function Cre(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.NOFRAMES:{mi(e,t);break}}}function Ire(e,t){t.chars=mn,e._insertCharacters(t)}function Rre(e,t){e._insertCharacters(t),e.framesetOk=!1}function MD(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ke.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Ore(e,t){if(Gte(t))MD(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ke.MATHML?yD(t):r===ke.SVG&&(Wte(t),bD(t)),Uv(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Lre(e,t){if(t.tagID===v.P||t.tagID===v.BR){MD(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ke.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}se.AREA,se.BASE,se.BASEFONT,se.BGSOUND,se.BR,se.COL,se.EMBED,se.FRAME,se.HR,se.IMG,se.INPUT,se.KEYGEN,se.LINK,se.META,se.PARAM,se.SOURCE,se.TRACK,se.WBR;const Mre=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,jre=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),M2={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function jD(e,t){const n=Kre(e),r=X3("type",{handlers:{root:Dre,element:Pre,text:Bre,comment:PD,doctype:Fre,raw:$re},unknown:Hre}),s={parser:n?new R2(M2):R2.getFragmentParser(void 0,M2),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),pu(s,Bi());const i=n?s.parser.document:s.parser.getFragment(),a=Yee(i,{file:s.options.file});return s.stitches&&eh(a,"comment",function(o,c,u){const d=o;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function DD(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Nt.CHARACTER,chars:e.value,location:rh(e)};pu(t,Bi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Fre(e,t){const n={type:Nt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:rh(e)};pu(t,Bi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Ure(e,t){t.stitches=!0;const n=Yre(e);if("children"in e&&"children"in n){const r=jD({type:"root",children:e.children},t.options);n.children=r.children}PD({type:"comment",value:{stitch:n}},t)}function PD(e,t){const n=e.value,r={type:Nt.COMMENT,data:n,location:rh(e)};pu(t,Bi(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function $re(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,BD(t,Bi(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Mre,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function Hre(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Ure(n,t);else{let r="";throw jre.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function pu(e,t){BD(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Pn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function BD(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function zre(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Pn.PLAINTEXT)return;pu(t,Bi(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:Bo.html;s===Bo.html&&n==="svg"&&(s=Bo.svg);const i=Qee({...e,children:[]},{space:s===Bo.svg?"svg":"html"}),a={type:Nt.START_TAG,tagName:n,tagID:hu(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:rh(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Vre(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&ite.includes(n)||t.parser.tokenizer.state===Pn.PLAINTEXT)return;pu(t,i0(e));const r={type:Nt.END_TAG,tagName:n,tagID:hu(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:rh(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Pn.RCDATA||t.parser.tokenizer.state===Pn.RAWTEXT||t.parser.tokenizer.state===Pn.SCRIPT_DATA)&&(t.parser.tokenizer.state=Pn.DATA)}function Kre(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function rh(e){const t=Bi(e)||{line:void 0,column:void 0,offset:void 0},n=i0(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function Yre(e){return"children"in e?Hc({...e,children:[]}):Hc(e)}function Gre(e){return function(t,n){return jD(t,{...e,file:n})}}const FD=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function UD(e){if(!e)return!1;try{const t=e.toLowerCase();return FD.some(n=>t.includes(n))}catch{return!1}}function Wre(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(UD(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(i=>(i==null?void 0:i.value)||"").join("").toLowerCase();return FD.some(i=>s.includes(i))}return!1}function qre({text:e,className:t,allowRawHtml:n=!0}){const[r,s]=E.useState(null),i=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const g=d(m);if(g)return g}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return l.jsxs("div",{className:t?`md ${t}`:"md",children:[l.jsx(Zq,{remarkPlugins:[dZ],rehypePlugins:n?[Gre,y2]:[y2],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(UD(d)||Wre(c))){const f=d,h=o(c==null?void 0:c.children);return l.jsxs("div",{className:"video-container",children:[l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>s({src:f,title:h}),children:[l.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]}),l.jsx("div",{className:"video-caption",children:l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return l.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=l.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?l.jsx(KL,{src:u,children:l.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,l.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=i({src:u},d);return h?l.jsx("div",{className:"video-container",children:l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:h}),children:[l.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]})}):l.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&l.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:l.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[l.jsxs("div",{className:"video-viewer-header",children:[l.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),l.jsxs("nav",{className:"video-viewer-nav",children:[l.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:l.jsx(Jw,{})}),l.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:l.jsx(Zr,{})})]})]}),l.jsx("div",{className:"video-viewer-body",children:l.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const sh=E.memo(qre),j2=6,D2=7,Xre={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function UE(e){return Xre[(e||"").trim().toLowerCase()]||"未知"}function P2(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function Qre(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function Zre(e){const t=e.replace(/\r\n/g,` +`))}function c(p,m,g,x){const y=g.enter("tableCell"),w=g.enter("phrasing"),b=g.containerPhrasing(p,{...x,before:i,after:i});return w(),y(),b}function u(p,m){return UX(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function d(p,m,g){const x=p.children;let y=-1;const w=[],b=m.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const VQ={tokenize:ZQ,partial:!0};function KQ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qQ,continuation:{tokenize:XQ},exit:QQ}},text:{91:{name:"gfmFootnoteCall",tokenize:WQ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:YQ,resolveTo:GQ}}}}function YQ(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const u=di(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function GQ(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function WQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!a||f===null||f===91||Qt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(di(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Qt(f)||(a=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function qQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Qt(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=di(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Qt(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),Dt(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function XQ(e,t,n){return e.check(Zf,t,e.attempt(VQ,t,n))}function QQ(e){e.exit("gfmFootnoteDefinition")}function ZQ(e,t,n){const r=this;return Dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function JQ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const x=a.exit("strikethroughSequenceTemporary"),y=Hc(m);return x._open=!y||y===2&&!!g,x._close=!g||g===2&&!!y,o(m)}}}class eZ{constructor(){this.map=[]}add(t,n,r){tZ(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function tZ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const L=r.events[O][1].type;if(L==="lineEnding"||L==="linePrefix")O--;else break}const F=O>-1?r.events[O][1].type:null,q=F==="tableHead"||F==="tableRow"?N:c;return q===N&&r.parser.lazy[r.now().line]?n(R):q(R)}function c(R){return e.enter("tableHead"),e.enter("tableRow"),u(R)}function u(R){return R===124||(a=!0,i+=1),d(R)}function d(R){return R===null?n(R):Je(R)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),p):n(R):St(R)?Dt(e,d,"whitespace")(R):(i+=1,a&&(a=!1,s+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(R)))}function f(R){return R===null||R===124||Qt(R)?(e.exit("data"),d(R)):(e.consume(R),R===92?h:f)}function h(R){return R===92||R===124?(e.consume(R),f):f(R)}function p(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),a=!1,St(R)?Dt(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):m(R))}function m(R){return R===45||R===58?x(R):R===124?(a=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),g):k(R)}function g(R){return St(R)?Dt(e,x,"whitespace")(R):x(R)}function x(R){return R===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),y):R===45?(i+=1,y(R)):R===null||Je(R)?_(R):k(R)}function y(R){return R===45?(e.enter("tableDelimiterFiller"),w(R)):k(R)}function w(R){return R===45?(e.consume(R),w):R===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(R))}function b(R){return St(R)?Dt(e,_,"whitespace")(R):_(R)}function _(R){return R===124?m(R):R===null||Je(R)?!a||s!==i?k(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):k(R)}function k(R){return n(R)}function N(R){return e.enter("tableRow"),A(R)}function A(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),A):R===null||Je(R)?(e.exit("tableRow"),t(R)):St(R)?Dt(e,A,"whitespace")(R):(e.enter("data"),S(R))}function S(R){return R===null||R===124||Qt(R)?(e.exit("data"),A(R)):(e.consume(R),R===92?C:S)}function C(R){return R===92||R===124?(e.consume(R),S):S(R)}}function iZ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,u,d,f;const h=new eZ;for(;++nn[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},Dl(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function ZT(e,t,n,r,s){const i=[],a=Dl(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function Dl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const aZ={name:"tasklistCheck",tokenize:lZ};function oZ(){return{text:{91:aZ}}}function lZ(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Qt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return Je(c)?t(c):St(c)?e.check({tokenize:cZ},t,n)(c):n(c)}}function cZ(e,t,n){return Dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function uZ(e){return k3([jQ(),KQ(),JQ(e),rZ(),oZ()])}const dZ={};function fZ(e){const t=this,n=e||dZ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(uZ(n)),i.push(RQ()),a.push(OQ(n))}const JT=function(e,t,n){const r=Jf(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` +`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function yj(e,t,n){return e.type==="element"?xZ(e,t,n):e.type==="text"?n.whitespace==="normal"?bj(e,n):wZ(e):[]}function xZ(e,t,n){const r=Ej(e,n),s=e.children||[];let i=-1,a=[];if(bZ(e))return a;let o,c;for(ME(e)||r2(e)&&JT(t,e,r2)?c=` +`:yZ(e)?(o=2,c=2):gj(e)&&(o=1,c=1);++i]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function AZ(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=TZ(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function xj(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(o);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],x=["true","false"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],k=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:x,built_in:[...w,...b,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,i,a,y,o,c,u,d,n]}}function CZ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",x={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:x,contains:y.concat([{begin:/\(/,end:/\)/,keywords:x,contains:y.concat(["self"]),relevance:0}]),relevance:0},b={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:x,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:x,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:x,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:x,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:x}}}function IZ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],x=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],_={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:x},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function RZ(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],a={keyword:s.concat(i),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},x=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[x,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,g,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const OZ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),LZ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],MZ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],jZ=[...LZ,...MZ],DZ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),PZ=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),BZ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),FZ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function UZ(e){const t=e.regex,n=OZ(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+PZ.join("|")+")"},{begin:":(:)?("+BZ.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+FZ.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:DZ.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jZ.join("|")+")\\b"}]}}function $Z(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function HZ(e){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"vj(e,t,n-1))}function VZ(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+vj("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,s2,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},s2,u]}}const i2="[A-Za-z$_][0-9A-Za-z$_]*",KZ=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],YZ=["true","false","null","undefined","NaN","Infinity"],_j=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],kj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Nj=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],GZ=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],WZ=[].concat(Nj,_j,kj);function Sj(e){const t=e.regex,n=(j,{after:U})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,U)=>{const I=j[0].length+j.index,K=j.input[I];if(K==="<"||K===","){U.ignoreMatch();return}K===">"&&(n(j,{after:I})||U.ignoreMatch());let W;const B=j.input.substring(I);if(W=B.match(/^\s*=/)){U.ignoreMatch();return}if((W=B.match(/^\s+extends\s+/))&&W.index===0){U.ignoreMatch();return}}},o={$pattern:i2,keyword:KZ,literal:YZ,built_in:WZ,"variable.language":GZ},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(w,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[..._j,...kj]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(j){return t.concat("(?!",j.join("|"),")")}const q={match:t.concat(/\b/,F([...Nj,"super","import"].map(j=>`${j}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,w,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},q,O,A,D,{match:/\$[(.]/}]}}function Tj(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Bl="[0-9](_*[0-9])*",lp=`\\.(${Bl})`,cp="[0-9a-fA-F](_*[0-9a-fA-F])*",qZ={className:"number",variants:[{begin:`(\\b(${Bl})((${lp})|\\.)?|(${lp}))[eE][+-]?(${Bl})[fFdD]?\\b`},{begin:`\\b(${Bl})((${lp})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${lp})[fFdD]?\\b`},{begin:`\\b(${Bl})[fFdD]\\b`},{begin:`\\b0[xX]((${cp})\\.?|(${cp})?\\.(${cp}))[pP][+-]?(${Bl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${cp})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function XZ(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=qZ,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,c,a,e.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const QZ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ZZ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],JZ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],eJ=[...ZZ,...JZ],tJ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Aj=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Cj=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),nJ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),rJ=Aj.concat(Cj).sort().reverse();function sJ(e){const t=QZ(e),n=rJ,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",a=[],o=[],c=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},u=function(b,_,k){return{className:b,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:tJ.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+nJ.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},x={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+eJ.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Aj.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Cj.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},w={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,x,w,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function iJ(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Ij(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function aJ(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function oJ(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[e.BACKSLASH_ESCAPE,i,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(g,x,y="\\1")=>{const w=y==="\\1"?y:t.concat(y,x);return t.concat(t.concat("(?:",g,")"),x,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,x,y)=>t.concat(t.concat("(?:",g,")"),x,/(?:\\.|[^\\\/])*?/,y,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function lJ(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(L,D)=>{D.data._beginMatch=L[1]||L[2]},"on:end":(L,D)=>{D.data._beginMatch!==L[1]&&D.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,m={scope:"string",variants:[d,u,f,h]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},x=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],_={keyword:y,literal:(L=>{const D=[];return L.forEach(T=>{D.push(T),T.toLowerCase()===T?D.push(T.toUpperCase()):D.push(T.toLowerCase())}),D})(x),built_in:w},k=L=>L.map(D=>D.replace(/\|\d+$/,"")),N={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(w).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},A=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),A],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},R={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[C,a,S,e.C_BLOCK_COMMENT_MODE,m,g,N]},O={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(y).join("\\b|"),"|",k(w).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[R]};R.contains.push(O);const F=[C,S,e.C_BLOCK_COMMENT_MODE,m,g,N],q={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:x,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:x,keyword:["new","array"]},contains:["self",...F]},...F,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:_,contains:[q,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},a,O,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},N,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:_,contains:["self",q,a,S,e.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,g]}}function cJ(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function uJ(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Oj(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},x={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",c,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,x,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,f]}]}}function dJ(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function fJ(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function hJ(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(r,/(::\w+)*/),a={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},o={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},N=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,u),relevance:0}].concat(c,u);d.contains=N,g.contains=N;const R=[{begin:/^\s*=>/,starts:{end:"$",contains:N}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:N}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(R).concat(u).concat(N)}}function pJ(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:d,keyword:o,literal:c,built_in:u},illegal:""},i]}}const mJ=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),gJ=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],yJ=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],bJ=[...gJ,...yJ],EJ=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),xJ=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),wJ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),vJ=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function _J(e){const t=mJ(e),n=wJ,r=xJ,s="@[a-z-]+",i="and or not only",o={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+bJ.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+vJ.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,o,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:EJ.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function kJ(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function NJ(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,m=[...u,...c].filter(k=>!d.includes(k)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},x={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function w(k){return t.concat(/\b/,t.either(...k.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const b={scope:"keyword",match:w(h),relevance:0};function _(k,{exceptions:N,when:A}={}){const S=A;return N=N||[],k.map(C=>C.match(/\|\d+$/)||N.includes(C)?C:S(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:i,type:o,built_in:f},contains:[{scope:"type",match:w(a)},b,y,g,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,x]}}function Lj(e){return e?typeof e=="string"?e:e.source:null}function Ku(e){return Gt("(?=",e,")")}function Gt(...e){return e.map(n=>Lj(n)).join("")}function SJ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Rr(...e){return"("+(SJ(e).capture?"":"?:")+e.map(r=>Lj(r)).join("|")+")"}const Lv=e=>Gt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),TJ=["Protocol","Type"].map(Lv),a2=["init","self"].map(Lv),AJ=["Any","Self"],ib=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],o2=["false","nil","true"],CJ=["assignment","associativity","higherThan","left","lowerThan","none","right"],IJ=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],l2=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Mj=Rr(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),jj=Rr(Mj,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),ab=Gt(Mj,jj,"*"),Dj=Rr(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Qm=Rr(Dj,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ki=Gt(Dj,Qm,"*"),up=Gt(/[A-Z]/,Qm,"*"),RJ=["attached","autoclosure",Gt(/convention\(/,Rr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Gt(/objc\(/,ki,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],OJ=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function LJ(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,Rr(...TJ,...a2)],className:{2:"keyword"}},i={match:Gt(/\./,Rr(...ib)),relevance:0},a=ib.filter(Ie=>typeof Ie=="string").concat(["_|0"]),o=ib.filter(Ie=>typeof Ie!="string").concat(AJ).map(Lv),c={variants:[{className:"keyword",match:Rr(...o,...a2)}]},u={$pattern:Rr(/\b\w+/,/#\w+/),keyword:a.concat(IJ),literal:o2},d=[s,i,c],f={match:Gt(/\./,Rr(...l2)),relevance:0},h={className:"built_in",match:Gt(/\b/,Rr(...l2),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:ab},{match:`\\.(\\.|${jj})+`}]},x=[m,g],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(Ie="")=>({className:"subst",variants:[{match:Gt(/\\/,Ie,/[0\\tnr"']/)},{match:Gt(/\\/,Ie,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(Ie="")=>({className:"subst",match:Gt(/\\/,Ie,/[\t ]*(?:[\r\n]|\r\n)/)}),N=(Ie="")=>({className:"subst",label:"interpol",begin:Gt(/\\/,Ie,/\(/),end:/\)/}),A=(Ie="")=>({begin:Gt(Ie,/"""/),end:Gt(/"""/,Ie),contains:[_(Ie),k(Ie),N(Ie)]}),S=(Ie="")=>({begin:Gt(Ie,/"/),end:Gt(/"/,Ie),contains:[_(Ie),N(Ie)]}),C={className:"string",variants:[A(),A("#"),A("##"),A("###"),S(),S("#"),S("##"),S("###")]},R=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],O={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:R},F=Ie=>{const We=Gt(Ie,/\//),Ce=Gt(/\//,Ie);return{begin:We,end:Ce,contains:[...R,{scope:"comment",begin:`#(?!.*${Ce})`,end:/$/}]}},q={scope:"regexp",variants:[F("###"),F("##"),F("#"),O]},L={match:Gt(/`/,ki,/`/)},D={className:"variable",match:/\$\d+/},T={className:"variable",match:`\\$${Qm}+`},M=[L,D,T],j={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:OJ,contains:[...x,b,C]}]}},U={scope:"keyword",match:Gt(/@/,Rr(...RJ),Ku(Rr(/\(/,/\s+/)))},I={scope:"meta",match:Gt(/@/,ki)},K=[j,U,I],W={match:Ku(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Gt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Qm,"+")},{className:"type",match:up,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Gt(/\s+&\s+/,Ku(up)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...K,m,W]};W.contains.push(B);const ie={match:Gt(ki,/\s*:/),keywords:"_|0",relevance:0},Q={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ie,...r,q,...d,...p,...x,b,C,...M,...K,W]},ee={begin://,keywords:"repeat each",contains:[...r,W]},ce={begin:Rr(Ku(Gt(ki,/\s*:/)),Ku(Gt(ki,/\s+/,ki,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ki}]},J={begin:/\(/,end:/\)/,keywords:u,contains:[ce,...r,...d,...x,b,C,...K,W,Q],endsParent:!0,illegal:/["']/},fe={match:[/(func|macro)/,/\s+/,Rr(L.match,ki,ab)],className:{1:"keyword",3:"title.function"},contains:[ee,J,t],illegal:[/\[/,/%/]},te={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ee,J,t],illegal:/\[|%/},ge={match:[/operator/,/\s+/,ab],className:{1:"keyword",3:"title"}},we={begin:[/precedencegroup/,/\s+/,up],className:{1:"keyword",3:"title"},contains:[W],keywords:[...CJ,...o2],end:/}/},Z={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ki,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[ee,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:up},...d],relevance:0}]};for(const Ie of C.variants){const We=Ie.contains.find(et=>et.label==="interpol");We.keywords=u;const Ce=[...d,...p,...x,b,C,...M];We.contains=[...Ce,{begin:/\(/,end:/\)/,contains:["self",...Ce]}]}return{name:"Swift",keywords:u,contains:[...r,fe,te,Z,me,Ne,ge,we,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},q,...d,...p,...x,b,C,...M,...K,W,Q]}}const Zm="[A-Za-z$_][0-9A-Za-z$_]*",Pj=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Bj=["true","false","null","undefined","NaN","Infinity"],Fj=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Uj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],$j=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Hj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],zj=[].concat($j,Fj,Uj);function MJ(e){const t=e.regex,n=(j,{after:U})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(j,U)=>{const I=j[0].length+j.index,K=j.input[I];if(K==="<"||K===","){U.ignoreMatch();return}K===">"&&(n(j,{after:I})||U.ignoreMatch());let W;const B=j.input.substring(I);if(W=B.match(/^\s*=/)){U.ignoreMatch();return}if((W=B.match(/^\s+extends\s+/))&&W.index===0){U.ignoreMatch();return}}},o={$pattern:Zm,keyword:Pj,literal:Bj,built_in:zj,"variable.language":Hj},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(w,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},A={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},S={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Fj,...Uj]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},R={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},O={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function F(j){return t.concat("(?!",j.join("|"),")")}const q={match:t.concat(/\b/,F([...$j,"super","import"].map(j=>`${j}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,x,w,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},M,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},R,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},q,O,A,D,{match:/\$[(.]/}]}}function Vj(e){const t=e.regex,n=MJ(e),r=Zm,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Zm,keyword:Pj.concat(c),literal:Bj,built_in:zj.concat(s),"variable.language":Hj},d={className:"meta",begin:"@"+r},f=(g,x,y)=>{const w=g.contains.findIndex(b=>b.label===x);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,i,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function jJ(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(a,o),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,c,u,d,f,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function DJ(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,a,s,e.QUOTE_STRING_MODE,c,u,o]}}function PJ(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,c,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,a,c,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Kj(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},x=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,g,i,a],y=[...x];return y.pop(),y.push(o),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:x}}const BJ={arduino:AZ,bash:xj,c:CZ,cpp:IZ,csharp:RZ,css:UZ,diff:$Z,go:HZ,graphql:zZ,ini:wj,java:VZ,javascript:Sj,json:Tj,kotlin:XZ,less:sJ,lua:iJ,makefile:Ij,markdown:Rj,objectivec:aJ,perl:oJ,php:lJ,"php-template":cJ,plaintext:uJ,python:Oj,"python-repl":dJ,r:fJ,ruby:hJ,rust:pJ,scss:_J,shell:kJ,sql:NJ,swift:LJ,typescript:Vj,vbnet:jJ,wasm:DJ,xml:PJ,yaml:Kj};function Yj(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&Yj(n)}),e}let c2=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Gj(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function za(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const FJ="",u2=e=>!!e.scope,UJ=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class $J{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Gj(t)}openNode(t){if(!u2(t))return;const n=UJ(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){u2(t)&&(this.buffer+=FJ)}value(){return this.buffer}span(t){this.buffer+=``}}const d2=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Mv{constructor(){this.rootNode=d2(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=d2({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Mv._collapse(n)}))}}class HJ extends Mv{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new $J(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _f(e){return e?typeof e=="string"?e:e.source:null}function Wj(e){return gl("(?=",e,")")}function zJ(e){return gl("(?:",e,")*")}function VJ(e){return gl("(?:",e,")?")}function gl(...e){return e.map(n=>_f(n)).join("")}function KJ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function jv(...e){return"("+(KJ(e).capture?"":"?:")+e.map(r=>_f(r)).join("|")+")"}function qj(e){return new RegExp(e.toString()+"|").exec("").length-1}function YJ(e,t){const n=e&&e.exec(t);return n&&n.index===0}const GJ=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Dv(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=_f(r),a="";for(;i.length>0;){const o=GJ.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+s):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const WJ=/\b\B/,Xj="[a-zA-Z]\\w*",Pv="[a-zA-Z_]\\w*",Qj="\\b\\d+(\\.\\d+)?",Zj="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Jj="\\b(0b[01]+)",qJ="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",XJ=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=gl(t,/.*\b/,e.binary,/\b.*/)),za({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},kf={begin:"\\\\[\\s\\S]",relevance:0},QJ={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[kf]},ZJ={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[kf]},JJ={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},u0=function(e,t,n={}){const r=za({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=jv("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:gl(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},eee=u0("//","$"),tee=u0("/\\*","\\*/"),nee=u0("#","$"),ree={scope:"number",begin:Qj,relevance:0},see={scope:"number",begin:Zj,relevance:0},iee={scope:"number",begin:Jj,relevance:0},aee={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[kf,{begin:/\[/,end:/\]/,relevance:0,contains:[kf]}]},oee={scope:"title",begin:Xj,relevance:0},lee={scope:"title",begin:Pv,relevance:0},cee={begin:"\\.\\s*"+Pv,relevance:0},uee=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var dp=Object.freeze({__proto__:null,APOS_STRING_MODE:QJ,BACKSLASH_ESCAPE:kf,BINARY_NUMBER_MODE:iee,BINARY_NUMBER_RE:Jj,COMMENT:u0,C_BLOCK_COMMENT_MODE:tee,C_LINE_COMMENT_MODE:eee,C_NUMBER_MODE:see,C_NUMBER_RE:Zj,END_SAME_AS_BEGIN:uee,HASH_COMMENT_MODE:nee,IDENT_RE:Xj,MATCH_NOTHING_RE:WJ,METHOD_GUARD:cee,NUMBER_MODE:ree,NUMBER_RE:Qj,PHRASAL_WORDS_MODE:JJ,QUOTE_STRING_MODE:ZJ,REGEXP_MODE:aee,RE_STARTERS_RE:qJ,SHEBANG:XJ,TITLE_MODE:oee,UNDERSCORE_IDENT_RE:Pv,UNDERSCORE_TITLE_MODE:lee});function dee(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function fee(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function hee(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=dee,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function pee(e,t){Array.isArray(e.illegal)&&(e.illegal=jv(...e.illegal))}function mee(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function gee(e,t){e.relevance===void 0&&(e.relevance=1)}const yee=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=gl(n.beforeMatch,Wj(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},bee=["of","and","for","in","not","or","if","then","parent","list","value"],Eee="keyword";function eD(e,t,n=Eee){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,eD(e[i],t,i))}),r;function s(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const c=o.split("|");r[c[0]]=[i,xee(c[0],c[1])]})}}function xee(e,t){return t?Number(t):wee(e)?0:1}function wee(e){return bee.includes(e.toLowerCase())}const f2={},Yo=e=>{console.error(e)},h2=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Cl=(e,t)=>{f2[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),f2[`${e}/${t}`]=!0)},Jm=new Error;function tD(e,t,{key:n}){let r=0;const s=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+r]=s[o],i[o+r]=!0,r+=qj(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function vee(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Yo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Jm;if(typeof e.beginScope!="object"||e.beginScope===null)throw Yo("beginScope must be object"),Jm;tD(e,e.begin,{key:"beginScope"}),e.begin=Dv(e.begin,{joinWith:""})}}function _ee(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Yo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Jm;if(typeof e.endScope!="object"||e.endScope===null)throw Yo("endScope must be object"),Jm;tD(e,e.end,{key:"endScope"}),e.end=Dv(e.end,{joinWith:""})}}function kee(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Nee(e){kee(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),vee(e),_ee(e)}function See(e){function t(a,o){return new RegExp(_f(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,o]),this.matchAt+=qj(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(c=>c[1]);this.matcherRe=t(Dv(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(o);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const c=new n;return this.rules.slice(o).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[o]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,c){this.rules.push([o,c]),c.type==="begin"&&this.count++}exec(o){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function s(a){const o=new r;return a.contains.forEach(c=>o.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const c=a;if(a.isCompiled)return c;[fee,mee,Nee,yee].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[hee,pee,gee].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=eD(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=_f(c.end)||"",a.endsWithParent&&o.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return Tee(d==="self"?a:d)})),a.contains.forEach(function(d){i(d,c)}),a.starts&&i(a.starts,o),c.matcher=s(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=za(e.classNameAliases||{}),i(e)}function nD(e){return e?e.endsWithParent||nD(e.starts):!1}function Tee(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return za(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:nD(e)?za(e,{starts:e.starts?za(e.starts):null}):Object.isFrozen(e)?za(e):e}var Aee="11.11.1";class Cee extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const ob=Gj,p2=za,m2=Symbol("nomatch"),Iee=7,rD=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:HJ};function c(T){return o.noHighlightRe.test(T)}function u(T){let M=T.className+" ";M+=T.parentNode?T.parentNode.className:"";const j=o.languageDetectRe.exec(M);if(j){const U=S(j[1]);return U||(h2(i.replace("{}",j[1])),h2("Falling back to no-highlight mode for this block.",T)),U?j[1]:"no-highlight"}return M.split(/\s+/).find(U=>c(U)||S(U))}function d(T,M,j){let U="",I="";typeof M=="object"?(U=T,j=M.ignoreIllegals,I=M.language):(Cl("10.7.0","highlight(lang, code, ...args) has been deprecated."),Cl("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),I=T,U=M),j===void 0&&(j=!0);const K={code:U,language:I};L("before:highlight",K);const W=K.result?K.result:f(K.language,K.code,j);return W.code=K.code,L("after:highlight",W),W}function f(T,M,j,U){const I=Object.create(null);function K(X,ne){return X.keywords[ne]}function W(){if(!Ce.keywords){Ge.addText(Xe);return}let X=0;Ce.keywordPatternRe.lastIndex=0;let ne=Ce.keywordPatternRe.exec(Xe),he="";for(;ne;){he+=Xe.substring(X,ne.index);const Te=Ne.case_insensitive?ne[0].toLowerCase():ne[0],He=K(Ce,Te);if(He){const[qe,Ut]=He;if(Ge.addText(he),he="",I[Te]=(I[Te]||0)+1,I[Te]<=Iee&&(xt+=Ut),qe.startsWith("_"))he+=ne[0];else{const Ye=Ne.classNameAliases[qe]||qe;Q(ne[0],Ye)}}else he+=ne[0];X=Ce.keywordPatternRe.lastIndex,ne=Ce.keywordPatternRe.exec(Xe)}he+=Xe.substring(X),Ge.addText(he)}function B(){if(Xe==="")return;let X=null;if(typeof Ce.subLanguage=="string"){if(!t[Ce.subLanguage]){Ge.addText(Xe);return}X=f(Ce.subLanguage,Xe,!0,et[Ce.subLanguage]),et[Ce.subLanguage]=X._top}else X=p(Xe,Ce.subLanguage.length?Ce.subLanguage:null);Ce.relevance>0&&(xt+=X.relevance),Ge.__addSublanguage(X._emitter,X.language)}function ie(){Ce.subLanguage!=null?B():W(),Xe=""}function Q(X,ne){X!==""&&(Ge.startScope(ne),Ge.addText(X),Ge.endScope())}function ee(X,ne){let he=1;const Te=ne.length-1;for(;he<=Te;){if(!X._emit[he]){he++;continue}const He=Ne.classNameAliases[X[he]]||X[he],qe=ne[he];He?Q(qe,He):(Xe=qe,W(),Xe=""),he++}}function ce(X,ne){return X.scope&&typeof X.scope=="string"&&Ge.openNode(Ne.classNameAliases[X.scope]||X.scope),X.beginScope&&(X.beginScope._wrap?(Q(Xe,Ne.classNameAliases[X.beginScope._wrap]||X.beginScope._wrap),Xe=""):X.beginScope._multi&&(ee(X.beginScope,ne),Xe="")),Ce=Object.create(X,{parent:{value:Ce}}),Ce}function J(X,ne,he){let Te=YJ(X.endRe,he);if(Te){if(X["on:end"]){const He=new c2(X);X["on:end"](ne,He),He.isMatchIgnored&&(Te=!1)}if(Te){for(;X.endsParent&&X.parent;)X=X.parent;return X}}if(X.endsWithParent)return J(X.parent,ne,he)}function fe(X){return Ce.matcher.regexIndex===0?(Xe+=X[0],1):(ut=!0,0)}function te(X){const ne=X[0],he=X.rule,Te=new c2(he),He=[he.__beforeBegin,he["on:begin"]];for(const qe of He)if(qe&&(qe(X,Te),Te.isMatchIgnored))return fe(ne);return he.skip?Xe+=ne:(he.excludeBegin&&(Xe+=ne),ie(),!he.returnBegin&&!he.excludeBegin&&(Xe=ne)),ce(he,X),he.returnBegin?0:ne.length}function ge(X){const ne=X[0],he=M.substring(X.index),Te=J(Ce,X,he);if(!Te)return m2;const He=Ce;Ce.endScope&&Ce.endScope._wrap?(ie(),Q(ne,Ce.endScope._wrap)):Ce.endScope&&Ce.endScope._multi?(ie(),ee(Ce.endScope,X)):He.skip?Xe+=ne:(He.returnEnd||He.excludeEnd||(Xe+=ne),ie(),He.excludeEnd&&(Xe=ne));do Ce.scope&&Ge.closeNode(),!Ce.skip&&!Ce.subLanguage&&(xt+=Ce.relevance),Ce=Ce.parent;while(Ce!==Te.parent);return Te.starts&&ce(Te.starts,X),He.returnEnd?0:ne.length}function we(){const X=[];for(let ne=Ce;ne!==Ne;ne=ne.parent)ne.scope&&X.unshift(ne.scope);X.forEach(ne=>Ge.openNode(ne))}let Z={};function me(X,ne){const he=ne&&ne[0];if(Xe+=X,he==null)return ie(),0;if(Z.type==="begin"&&ne.type==="end"&&Z.index===ne.index&&he===""){if(Xe+=M.slice(ne.index,ne.index+1),!s){const Te=new Error(`0 width match regex (${T})`);throw Te.languageName=T,Te.badRule=Z.rule,Te}return 1}if(Z=ne,ne.type==="begin")return te(ne);if(ne.type==="illegal"&&!j){const Te=new Error('Illegal lexeme "'+he+'" for mode "'+(Ce.scope||"")+'"');throw Te.mode=Ce,Te}else if(ne.type==="end"){const Te=ge(ne);if(Te!==m2)return Te}if(ne.type==="illegal"&&he==="")return Xe+=` +`,1;if(At>1e5&&At>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Xe+=he,he.length}const Ne=S(T);if(!Ne)throw Yo(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Ie=See(Ne);let We="",Ce=U||Ie;const et={},Ge=new o.__emitter(o);we();let Xe="",xt=0,gt=0,At=0,ut=!1;try{if(Ne.__emitTokens)Ne.__emitTokens(M,Ge);else{for(Ce.matcher.considerAll();;){At++,ut?ut=!1:Ce.matcher.considerAll(),Ce.matcher.lastIndex=gt;const X=Ce.matcher.exec(M);if(!X)break;const ne=M.substring(gt,X.index),he=me(ne,X);gt=X.index+he}me(M.substring(gt))}return Ge.finalize(),We=Ge.toHTML(),{language:T,value:We,relevance:xt,illegal:!1,_emitter:Ge,_top:Ce}}catch(X){if(X.message&&X.message.includes("Illegal"))return{language:T,value:ob(M),illegal:!0,relevance:0,_illegalBy:{message:X.message,index:gt,context:M.slice(gt-100,gt+100),mode:X.mode,resultSoFar:We},_emitter:Ge};if(s)return{language:T,value:ob(M),illegal:!1,relevance:0,errorRaised:X,_emitter:Ge,_top:Ce};throw X}}function h(T){const M={value:ob(T),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return M._emitter.addText(T),M}function p(T,M){M=M||o.languages||Object.keys(t);const j=h(T),U=M.filter(S).filter(R).map(ie=>f(ie,T,!1));U.unshift(j);const I=U.sort((ie,Q)=>{if(ie.relevance!==Q.relevance)return Q.relevance-ie.relevance;if(ie.language&&Q.language){if(S(ie.language).supersetOf===Q.language)return 1;if(S(Q.language).supersetOf===ie.language)return-1}return 0}),[K,W]=I,B=K;return B.secondBest=W,B}function m(T,M,j){const U=M&&n[M]||j;T.classList.add("hljs"),T.classList.add(`language-${U}`)}function g(T){let M=null;const j=u(T);if(c(j))return;if(L("before:highlightElement",{el:T,language:j}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(o.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(T)),o.throwUnescapedHTML))throw new Cee("One of your code blocks includes unescaped HTML.",T.innerHTML);M=T;const U=M.textContent,I=j?d(U,{language:j,ignoreIllegals:!0}):p(U);T.innerHTML=I.value,T.dataset.highlighted="yes",m(T,j,I.language),T.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(T.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),L("after:highlightElement",{el:T,result:I,text:U})}function x(T){o=p2(o,T)}const y=()=>{_(),Cl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function w(){_(),Cl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function _(){function T(){_()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",T,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(g)}function k(T,M){let j=null;try{j=M(e)}catch(U){if(Yo("Language definition for '{}' could not be registered.".replace("{}",T)),s)Yo(U);else throw U;j=a}j.name||(j.name=T),t[T]=j,j.rawDefinition=M.bind(null,e),j.aliases&&C(j.aliases,{languageName:T})}function N(T){delete t[T];for(const M of Object.keys(n))n[M]===T&&delete n[M]}function A(){return Object.keys(t)}function S(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function C(T,{languageName:M}){typeof T=="string"&&(T=[T]),T.forEach(j=>{n[j.toLowerCase()]=M})}function R(T){const M=S(T);return M&&!M.disableAutodetect}function O(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=M=>{T["before:highlightBlock"](Object.assign({block:M.el},M))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=M=>{T["after:highlightBlock"](Object.assign({block:M.el},M))})}function F(T){O(T),r.push(T)}function q(T){const M=r.indexOf(T);M!==-1&&r.splice(M,1)}function L(T,M){const j=T;r.forEach(function(U){U[j]&&U[j](M)})}function D(T){return Cl("10.7.0","highlightBlock will be removed entirely in v12.0"),Cl("10.7.0","Please use highlightElement now."),g(T)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:g,highlightBlock:D,configure:x,initHighlighting:y,initHighlightingOnLoad:w,registerLanguage:k,unregisterLanguage:N,listLanguages:A,getLanguage:S,registerAliases:C,autoDetection:R,inherit:p2,addPlugin:F,removePlugin:q}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=Aee,e.regex={concat:gl,lookahead:Wj,either:jv,optional:VJ,anyNumberOfTimes:zJ};for(const T in dp)typeof dp[T]=="object"&&Yj(dp[T]);return Object.assign(e,dp),e},Vc=rD({});Vc.newInstance=()=>rD({});var Ree=Vc;Vc.HighlightJS=Vc;Vc.default=Vc;const Qr=Bf(Ree),g2={},Oee="hljs-";function Lee(e){const t=Qr.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:a,registered:o};function n(c,u,d){const f=d||g2,h=typeof f.prefix=="string"?f.prefix:Oee;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:Mee,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(c,u){const f=(u||g2).subset||s();let h=-1,p=0,m;for(;++hp&&(p=x.data.relevance,m=x)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(c){return!!t.getLanguage(c)}}class Mee{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const jee={};function y2(e){const t=e||jee,n=t.aliases,r=t.detect||!1,s=t.languages||BJ,i=t.plainText,a=t.prefix,o=t.subset;let c="hljs";const u=Lee(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){eh(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const g=Dee(h);if(g===!1||!g&&!r||g&&i&&i.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const x=EZ(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,x,{prefix:a}):u.highlightAuto(x,{prefix:a,subset:o})}catch(w){const b=w;if(g&&/Unknown language/.test(b.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[m,h],cause:b,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw b}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function Dee(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const c=x2(t,n[a-1]);o=c===-1?t.length+1:c+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length1?n[i.line-2]:0)+i.column-1;if(a=55296&&e<=57343}function lte(e){return e>=56320&&e<=57343}function cte(e,t){return(e-55296)*1024+9216+t}function cD(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function uD(e){return e>=64976&&e<=65007||ote.has(e)}var pe;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(pe||(pe={}));const ute=65536;class dte{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=ute,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(lte(n))return this.pos++,this._addGap(),cte(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,H.EOF;return this._err(pe.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;const r=this.html.charCodeAt(n);return r===H.CARRIAGE_RETURN?H.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;let t=this.html.charCodeAt(this.pos);return t===H.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,H.LINE_FEED):t===H.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,lD(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===H.LINE_FEED||t===H.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){cD(t)?this._err(pe.controlCharacterInInputStream):uD(t)&&this._err(pe.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const fte=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),hte=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function pte(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=hte.get(e))!==null&&t!==void 0?t:e}var sr;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(sr||(sr={}));const mte=32;var Va;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Va||(Va={}));function DE(e){return e>=sr.ZERO&&e<=sr.NINE}function gte(e){return e>=sr.UPPER_A&&e<=sr.UPPER_F||e>=sr.LOWER_A&&e<=sr.LOWER_F}function yte(e){return e>=sr.UPPER_A&&e<=sr.UPPER_Z||e>=sr.LOWER_A&&e<=sr.LOWER_Z||DE(e)}function bte(e){return e===sr.EQUALS||yte(e)}var nr;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(nr||(nr={}));var ea;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(ea||(ea={}));class Ete{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=nr.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ea.Strict}startEntity(t){this.decodeMode=t,this.state=nr.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case nr.EntityStart:return t.charCodeAt(n)===sr.NUM?(this.state=nr.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=nr.NamedEntity,this.stateNamedEntity(t,n));case nr.NumericStart:return this.stateNumericStart(t,n);case nr.NumericDecimal:return this.stateNumericDecimal(t,n);case nr.NumericHex:return this.stateNumericHex(t,n);case nr.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|mte)===sr.LOWER_X?(this.state=nr.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=nr.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,i!==0){if(a===sr.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ea.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&Va.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Va.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case nr.NamedEntity:return this.result!==0&&(this.decodeMode!==ea.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case nr.NumericDecimal:return this.emitNumericEntity(0,2);case nr.NumericHex:return this.emitNumericEntity(0,3);case nr.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case nr.EntityStart:return 0}}}function xte(e,t,n,r){const s=(t&Va.BRANCH_LENGTH)>>7,i=t&Va.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const c=r-i;return c<0||c>=s?-1:e[n+c]-1}let a=n,o=a+s-1;for(;a<=o;){const c=a+o>>>1,u=e[c];if(ur)o=c-1;else return e[c+s]}return-1}var ke;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ke||(ke={}));var Go;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Go||(Go={}));var Is;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Is||(Is={}));var se;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(se||(se={}));var v;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(v||(v={}));const wte=new Map([[se.A,v.A],[se.ADDRESS,v.ADDRESS],[se.ANNOTATION_XML,v.ANNOTATION_XML],[se.APPLET,v.APPLET],[se.AREA,v.AREA],[se.ARTICLE,v.ARTICLE],[se.ASIDE,v.ASIDE],[se.B,v.B],[se.BASE,v.BASE],[se.BASEFONT,v.BASEFONT],[se.BGSOUND,v.BGSOUND],[se.BIG,v.BIG],[se.BLOCKQUOTE,v.BLOCKQUOTE],[se.BODY,v.BODY],[se.BR,v.BR],[se.BUTTON,v.BUTTON],[se.CAPTION,v.CAPTION],[se.CENTER,v.CENTER],[se.CODE,v.CODE],[se.COL,v.COL],[se.COLGROUP,v.COLGROUP],[se.DD,v.DD],[se.DESC,v.DESC],[se.DETAILS,v.DETAILS],[se.DIALOG,v.DIALOG],[se.DIR,v.DIR],[se.DIV,v.DIV],[se.DL,v.DL],[se.DT,v.DT],[se.EM,v.EM],[se.EMBED,v.EMBED],[se.FIELDSET,v.FIELDSET],[se.FIGCAPTION,v.FIGCAPTION],[se.FIGURE,v.FIGURE],[se.FONT,v.FONT],[se.FOOTER,v.FOOTER],[se.FOREIGN_OBJECT,v.FOREIGN_OBJECT],[se.FORM,v.FORM],[se.FRAME,v.FRAME],[se.FRAMESET,v.FRAMESET],[se.H1,v.H1],[se.H2,v.H2],[se.H3,v.H3],[se.H4,v.H4],[se.H5,v.H5],[se.H6,v.H6],[se.HEAD,v.HEAD],[se.HEADER,v.HEADER],[se.HGROUP,v.HGROUP],[se.HR,v.HR],[se.HTML,v.HTML],[se.I,v.I],[se.IMG,v.IMG],[se.IMAGE,v.IMAGE],[se.INPUT,v.INPUT],[se.IFRAME,v.IFRAME],[se.KEYGEN,v.KEYGEN],[se.LABEL,v.LABEL],[se.LI,v.LI],[se.LINK,v.LINK],[se.LISTING,v.LISTING],[se.MAIN,v.MAIN],[se.MALIGNMARK,v.MALIGNMARK],[se.MARQUEE,v.MARQUEE],[se.MATH,v.MATH],[se.MENU,v.MENU],[se.META,v.META],[se.MGLYPH,v.MGLYPH],[se.MI,v.MI],[se.MO,v.MO],[se.MN,v.MN],[se.MS,v.MS],[se.MTEXT,v.MTEXT],[se.NAV,v.NAV],[se.NOBR,v.NOBR],[se.NOFRAMES,v.NOFRAMES],[se.NOEMBED,v.NOEMBED],[se.NOSCRIPT,v.NOSCRIPT],[se.OBJECT,v.OBJECT],[se.OL,v.OL],[se.OPTGROUP,v.OPTGROUP],[se.OPTION,v.OPTION],[se.P,v.P],[se.PARAM,v.PARAM],[se.PLAINTEXT,v.PLAINTEXT],[se.PRE,v.PRE],[se.RB,v.RB],[se.RP,v.RP],[se.RT,v.RT],[se.RTC,v.RTC],[se.RUBY,v.RUBY],[se.S,v.S],[se.SCRIPT,v.SCRIPT],[se.SEARCH,v.SEARCH],[se.SECTION,v.SECTION],[se.SELECT,v.SELECT],[se.SOURCE,v.SOURCE],[se.SMALL,v.SMALL],[se.SPAN,v.SPAN],[se.STRIKE,v.STRIKE],[se.STRONG,v.STRONG],[se.STYLE,v.STYLE],[se.SUB,v.SUB],[se.SUMMARY,v.SUMMARY],[se.SUP,v.SUP],[se.TABLE,v.TABLE],[se.TBODY,v.TBODY],[se.TEMPLATE,v.TEMPLATE],[se.TEXTAREA,v.TEXTAREA],[se.TFOOT,v.TFOOT],[se.TD,v.TD],[se.TH,v.TH],[se.THEAD,v.THEAD],[se.TITLE,v.TITLE],[se.TR,v.TR],[se.TRACK,v.TRACK],[se.TT,v.TT],[se.U,v.U],[se.UL,v.UL],[se.SVG,v.SVG],[se.VAR,v.VAR],[se.WBR,v.WBR],[se.XMP,v.XMP]]);function pu(e){var t;return(t=wte.get(e))!==null&&t!==void 0?t:v.UNKNOWN}const Ae=v,vte={[ke.HTML]:new Set([Ae.ADDRESS,Ae.APPLET,Ae.AREA,Ae.ARTICLE,Ae.ASIDE,Ae.BASE,Ae.BASEFONT,Ae.BGSOUND,Ae.BLOCKQUOTE,Ae.BODY,Ae.BR,Ae.BUTTON,Ae.CAPTION,Ae.CENTER,Ae.COL,Ae.COLGROUP,Ae.DD,Ae.DETAILS,Ae.DIR,Ae.DIV,Ae.DL,Ae.DT,Ae.EMBED,Ae.FIELDSET,Ae.FIGCAPTION,Ae.FIGURE,Ae.FOOTER,Ae.FORM,Ae.FRAME,Ae.FRAMESET,Ae.H1,Ae.H2,Ae.H3,Ae.H4,Ae.H5,Ae.H6,Ae.HEAD,Ae.HEADER,Ae.HGROUP,Ae.HR,Ae.HTML,Ae.IFRAME,Ae.IMG,Ae.INPUT,Ae.LI,Ae.LINK,Ae.LISTING,Ae.MAIN,Ae.MARQUEE,Ae.MENU,Ae.META,Ae.NAV,Ae.NOEMBED,Ae.NOFRAMES,Ae.NOSCRIPT,Ae.OBJECT,Ae.OL,Ae.P,Ae.PARAM,Ae.PLAINTEXT,Ae.PRE,Ae.SCRIPT,Ae.SECTION,Ae.SELECT,Ae.SOURCE,Ae.STYLE,Ae.SUMMARY,Ae.TABLE,Ae.TBODY,Ae.TD,Ae.TEMPLATE,Ae.TEXTAREA,Ae.TFOOT,Ae.TH,Ae.THEAD,Ae.TITLE,Ae.TR,Ae.TRACK,Ae.UL,Ae.WBR,Ae.XMP]),[ke.MATHML]:new Set([Ae.MI,Ae.MO,Ae.MN,Ae.MS,Ae.MTEXT,Ae.ANNOTATION_XML]),[ke.SVG]:new Set([Ae.TITLE,Ae.FOREIGN_OBJECT,Ae.DESC]),[ke.XLINK]:new Set,[ke.XML]:new Set,[ke.XMLNS]:new Set},PE=new Set([Ae.H1,Ae.H2,Ae.H3,Ae.H4,Ae.H5,Ae.H6]);se.STYLE,se.SCRIPT,se.XMP,se.IFRAME,se.NOEMBED,se.NOFRAMES,se.PLAINTEXT;var V;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(V||(V={}));const Pn={DATA:V.DATA,RCDATA:V.RCDATA,RAWTEXT:V.RAWTEXT,SCRIPT_DATA:V.SCRIPT_DATA,PLAINTEXT:V.PLAINTEXT,CDATA_SECTION:V.CDATA_SECTION};function _te(e){return e>=H.DIGIT_0&&e<=H.DIGIT_9}function ud(e){return e>=H.LATIN_CAPITAL_A&&e<=H.LATIN_CAPITAL_Z}function kte(e){return e>=H.LATIN_SMALL_A&&e<=H.LATIN_SMALL_Z}function Oa(e){return kte(e)||ud(e)}function v2(e){return Oa(e)||_te(e)}function fp(e){return e+32}function fD(e){return e===H.SPACE||e===H.LINE_FEED||e===H.TABULATION||e===H.FORM_FEED}function _2(e){return fD(e)||e===H.SOLIDUS||e===H.GREATER_THAN_SIGN}function Nte(e){return e===H.NULL?pe.nullCharacterReference:e>1114111?pe.characterReferenceOutsideUnicodeRange:lD(e)?pe.surrogateCharacterReference:uD(e)?pe.noncharacterCharacterReference:cD(e)||e===H.CARRIAGE_RETURN?pe.controlCharacterReference:null}class Ste{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=V.DATA,this.returnState=V.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new dte(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ete(fte,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(pe.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(pe.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=Nte(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(pe.endTagWithAttributes),t.selfClosing&&this._err(pe.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Nt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Nt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Nt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Nt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=fD(t)?Nt.WHITESPACE_CHARACTER:t===H.NULL?Nt.NULL_CHARACTER:Nt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Nt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=V.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ea.Attribute:ea.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===V.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===V.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case V.DATA:{this._stateData(t);break}case V.RCDATA:{this._stateRcdata(t);break}case V.RAWTEXT:{this._stateRawtext(t);break}case V.SCRIPT_DATA:{this._stateScriptData(t);break}case V.PLAINTEXT:{this._statePlaintext(t);break}case V.TAG_OPEN:{this._stateTagOpen(t);break}case V.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case V.TAG_NAME:{this._stateTagName(t);break}case V.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case V.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case V.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case V.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case V.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case V.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case V.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case V.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case V.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case V.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case V.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case V.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case V.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case V.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case V.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case V.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case V.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case V.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case V.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case V.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case V.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case V.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case V.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case V.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case V.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case V.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case V.BOGUS_COMMENT:{this._stateBogusComment(t);break}case V.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case V.COMMENT_START:{this._stateCommentStart(t);break}case V.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case V.COMMENT:{this._stateComment(t);break}case V.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case V.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case V.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case V.COMMENT_END:{this._stateCommentEnd(t);break}case V.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case V.DOCTYPE:{this._stateDoctype(t);break}case V.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case V.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case V.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case V.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case V.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case V.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case V.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case V.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case V.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case V.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case V.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case V.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case V.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case V.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case V.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case V.CDATA_SECTION:{this._stateCdataSection(t);break}case V.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case V.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case V.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case V.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.TAG_OPEN;break}case H.AMPERSAND:{this._startCharacterReference();break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitCodePoint(t);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case H.AMPERSAND:{this._startCharacterReference();break}case H.LESS_THAN_SIGN:{this.state=V.RCDATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.RAWTEXT_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=V.SCRIPT_DATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case H.NULL:{this._err(pe.unexpectedNullCharacter),this._emitChars(mn);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Oa(t))this._createStartTagToken(),this.state=V.TAG_NAME,this._stateTagName(t);else switch(t){case H.EXCLAMATION_MARK:{this.state=V.MARKUP_DECLARATION_OPEN;break}case H.SOLIDUS:{this.state=V.END_TAG_OPEN;break}case H.QUESTION_MARK:{this._err(pe.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=V.BOGUS_COMMENT,this._stateBogusComment(t);break}case H.EOF:{this._err(pe.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(pe.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=V.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Oa(t))this._createEndTagToken(),this.state=V.TAG_NAME,this._stateTagName(t);else switch(t){case H.GREATER_THAN_SIGN:{this._err(pe.missingEndTagName),this.state=V.DATA;break}case H.EOF:{this._err(pe.eofBeforeTagName),this._emitChars("");break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_ESCAPED,this._emitChars(mn);break}case H.EOF:{this._err(pe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=V.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===H.SOLIDUS?this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Oa(t)?(this._emitChars("<"),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=V.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Oa(t)?(this.state=V.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case H.NULL:{this._err(pe.unexpectedNullCharacter),this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(mn);break}case H.EOF:{this._err(pe.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===H.SOLIDUS?(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=V.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(zr.SCRIPT,!1)&&_2(this.preprocessor.peek(zr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ke.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Rte,ke.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Ite,ke.HTML)}clearBackToTableRowContext(){this.clearBackTo(Cte,ke.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===v.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===v.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ke.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case ke.SVG:{if(S2.has(s))return!1;break}case ke.MATHML:{if(N2.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,eg)}hasInListItemScope(t){return this.hasInDynamicScope(t,Tte)}hasInButtonScope(t){return this.hasInDynamicScope(t,Ate)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ke.HTML:{if(PE.has(n))return!0;if(eg.has(n))return!1;break}case ke.SVG:{if(S2.has(n))return!1;break}case ke.MATHML:{if(N2.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ke.HTML)switch(this.tagIDs[n]){case t:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ke.HTML)switch(this.tagIDs[t]){case v.TBODY:case v.THEAD:case v.TFOOT:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ke.HTML)switch(this.tagIDs[n]){case t:return!0;case v.OPTION:case v.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&hD.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&k2.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&k2.has(this.currentTagId);)this.pop()}}const lb=3;var Ti;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Ti||(Ti={}));const T2={type:Ti.Marker};class Mte{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let i=0;for(let a=0;as.get(c.name)===c.value)&&(i+=1,i>=lb&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(T2)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Ti.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Ti.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(T2);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Ti.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Ti.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Ti.Element&&n.element===t)}}const La={createDocument(){return{nodeName:"#document",mode:Is.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};La.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(La.isTextNode(n)){n.value+=t;return}}La.appendChild(e,La.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&La.isTextNode(r)?r.value+=t:La.insertBefore(e,La.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function Ute(e){return e.name===pD&&e.publicId===null&&(e.systemId===null||e.systemId===jte)}function $te(e){if(e.name!==pD)return Is.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===Dte)return Is.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Bte.has(n))return Is.QUIRKS;let r=t===null?Pte:mD;if(A2(n,r))return Is.QUIRKS;if(r=t===null?gD:Fte,A2(n,r))return Is.LIMITED_QUIRKS}return Is.NO_QUIRKS}const C2={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Hte="definitionurl",zte="definitionURL",Vte=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Kte=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ke.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ke.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ke.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ke.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ke.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ke.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ke.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ke.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ke.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ke.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ke.XMLNS}]]),Yte=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Gte=new Set([v.B,v.BIG,v.BLOCKQUOTE,v.BODY,v.BR,v.CENTER,v.CODE,v.DD,v.DIV,v.DL,v.DT,v.EM,v.EMBED,v.H1,v.H2,v.H3,v.H4,v.H5,v.H6,v.HEAD,v.HR,v.I,v.IMG,v.LI,v.LISTING,v.MENU,v.META,v.NOBR,v.OL,v.P,v.PRE,v.RUBY,v.S,v.SMALL,v.SPAN,v.STRONG,v.STRIKE,v.SUB,v.SUP,v.TABLE,v.TT,v.U,v.UL,v.VAR]);function Wte(e){const t=e.tagID;return t===v.FONT&&e.attrs.some(({name:r})=>r===Go.COLOR||r===Go.SIZE||r===Go.FACE)||Gte.has(t)}function yD(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ke.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ke.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=G.TEXT}switchToPlaintextParsing(){this.insertionMode=G.TEXT,this.originalInsertionMode=G.IN_BODY,this.tokenizer.state=Pn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===se.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ke.HTML))switch(this.fragmentContextID){case v.TITLE:case v.TEXTAREA:{this.tokenizer.state=Pn.RCDATA;break}case v.STYLE:case v.XMP:case v.IFRAME:case v.NOEMBED:case v.NOFRAMES:case v.NOSCRIPT:{this.tokenizer.state=Pn.RAWTEXT;break}case v.SCRIPT:{this.tokenizer.state=Pn.SCRIPT_DATA;break}case v.PLAINTEXT:{this.tokenizer.state=Pn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ke.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ke.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(se.HTML,ke.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,v.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===Nt.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===v.SVG&&this.treeAdapter.getTagName(n)===se.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ke.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===v.MGLYPH||t.tagID===v.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ke.HTML)}_processToken(t){switch(t.type){case Nt.CHARACTER:{this.onCharacter(t);break}case Nt.NULL_CHARACTER:{this.onNullCharacter(t);break}case Nt.COMMENT:{this.onComment(t);break}case Nt.DOCTYPE:{this.onDoctype(t);break}case Nt.START_TAG:{this._processStartTag(t);break}case Nt.END_TAG:{this.onEndTag(t);break}case Nt.EOF:{this.onEof(t);break}case Nt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return Zte(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===Ti.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=G.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(v.P),this.openElements.popUntilTagNamePopped(v.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case v.TR:{this.insertionMode=G.IN_ROW;return}case v.TBODY:case v.THEAD:case v.TFOOT:{this.insertionMode=G.IN_TABLE_BODY;return}case v.CAPTION:{this.insertionMode=G.IN_CAPTION;return}case v.COLGROUP:{this.insertionMode=G.IN_COLUMN_GROUP;return}case v.TABLE:{this.insertionMode=G.IN_TABLE;return}case v.BODY:{this.insertionMode=G.IN_BODY;return}case v.FRAMESET:{this.insertionMode=G.IN_FRAMESET;return}case v.SELECT:{this._resetInsertionModeForSelect(t);return}case v.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case v.HTML:{this.insertionMode=this.headElement?G.AFTER_HEAD:G.BEFORE_HEAD;return}case v.TD:case v.TH:{if(t>0){this.insertionMode=G.IN_CELL;return}break}case v.HEAD:{if(t>0){this.insertionMode=G.IN_HEAD;return}break}}this.insertionMode=G.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===v.TEMPLATE)break;if(r===v.TABLE){this.insertionMode=G.IN_SELECT_IN_TABLE;return}}this.insertionMode=G.IN_SELECT}_isElementCausesFosterParenting(t){return ED.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case v.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ke.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case v.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return vte[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Ore(this,t);return}switch(this.insertionMode){case G.INITIAL:{Yu(this,t);break}case G.BEFORE_HTML:{Pd(this,t);break}case G.BEFORE_HEAD:{Bd(this,t);break}case G.IN_HEAD:{Fd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Ud(this,t);break}case G.AFTER_HEAD:{$d(this,t);break}case G.IN_BODY:case G.IN_CAPTION:case G.IN_CELL:case G.IN_TEMPLATE:{wD(this,t);break}case G.TEXT:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_TABLE_TEXT:{TD(this,t);break}case G.IN_COLUMN_GROUP:{tg(this,t);break}case G.AFTER_BODY:{ng(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Rre(this,t);return}switch(this.insertionMode){case G.INITIAL:{Yu(this,t);break}case G.BEFORE_HTML:{Pd(this,t);break}case G.BEFORE_HEAD:{Bd(this,t);break}case G.IN_HEAD:{Fd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Ud(this,t);break}case G.AFTER_HEAD:{$d(this,t);break}case G.TEXT:{this._insertCharacters(t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_COLUMN_GROUP:{tg(this,t);break}case G.AFTER_BODY:{ng(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){BE(this,t);return}switch(this.insertionMode){case G.INITIAL:case G.BEFORE_HTML:case G.BEFORE_HEAD:case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:case G.IN_BODY:case G.IN_TABLE:case G.IN_CAPTION:case G.IN_COLUMN_GROUP:case G.IN_TABLE_BODY:case G.IN_ROW:case G.IN_CELL:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:case G.IN_TEMPLATE:case G.IN_FRAMESET:case G.AFTER_FRAMESET:{BE(this,t);break}case G.IN_TABLE_TEXT:{Gu(this,t);break}case G.AFTER_BODY:{cne(this,t);break}case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{une(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case G.INITIAL:{dne(this,t);break}case G.BEFORE_HEAD:case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:{this._err(t,pe.misplacedDoctype);break}case G.IN_TABLE_TEXT:{Gu(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,pe.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Lre(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case G.INITIAL:{Yu(this,t);break}case G.BEFORE_HTML:{fne(this,t);break}case G.BEFORE_HEAD:{pne(this,t);break}case G.IN_HEAD:{mi(this,t);break}case G.IN_HEAD_NO_SCRIPT:{yne(this,t);break}case G.AFTER_HEAD:{Ene(this,t);break}case G.IN_BODY:{Tr(this,t);break}case G.IN_TABLE:{Kc(this,t);break}case G.IN_TABLE_TEXT:{Gu(this,t);break}case G.IN_CAPTION:{mre(this,t);break}case G.IN_COLUMN_GROUP:{zv(this,t);break}case G.IN_TABLE_BODY:{h0(this,t);break}case G.IN_ROW:{p0(this,t);break}case G.IN_CELL:{bre(this,t);break}case G.IN_SELECT:{ID(this,t);break}case G.IN_SELECT_IN_TABLE:{xre(this,t);break}case G.IN_TEMPLATE:{vre(this,t);break}case G.AFTER_BODY:{kre(this,t);break}case G.IN_FRAMESET:{Nre(this,t);break}case G.AFTER_FRAMESET:{Tre(this,t);break}case G.AFTER_AFTER_BODY:{Cre(this,t);break}case G.AFTER_AFTER_FRAMESET:{Ire(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Mre(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case G.INITIAL:{Yu(this,t);break}case G.BEFORE_HTML:{hne(this,t);break}case G.BEFORE_HEAD:{mne(this,t);break}case G.IN_HEAD:{gne(this,t);break}case G.IN_HEAD_NO_SCRIPT:{bne(this,t);break}case G.AFTER_HEAD:{xne(this,t);break}case G.IN_BODY:{f0(this,t);break}case G.TEXT:{ire(this,t);break}case G.IN_TABLE:{Nf(this,t);break}case G.IN_TABLE_TEXT:{Gu(this,t);break}case G.IN_CAPTION:{gre(this,t);break}case G.IN_COLUMN_GROUP:{yre(this,t);break}case G.IN_TABLE_BODY:{FE(this,t);break}case G.IN_ROW:{CD(this,t);break}case G.IN_CELL:{Ere(this,t);break}case G.IN_SELECT:{RD(this,t);break}case G.IN_SELECT_IN_TABLE:{wre(this,t);break}case G.IN_TEMPLATE:{_re(this,t);break}case G.AFTER_BODY:{LD(this,t);break}case G.IN_FRAMESET:{Sre(this,t);break}case G.AFTER_FRAMESET:{Are(this,t);break}case G.AFTER_AFTER_BODY:{Jp(this,t);break}}}onEof(t){switch(this.insertionMode){case G.INITIAL:{Yu(this,t);break}case G.BEFORE_HTML:{Pd(this,t);break}case G.BEFORE_HEAD:{Bd(this,t);break}case G.IN_HEAD:{Fd(this,t);break}case G.IN_HEAD_NO_SCRIPT:{Ud(this,t);break}case G.AFTER_HEAD:{$d(this,t);break}case G.IN_BODY:case G.IN_TABLE:case G.IN_CAPTION:case G.IN_COLUMN_GROUP:case G.IN_TABLE_BODY:case G.IN_ROW:case G.IN_CELL:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:{ND(this,t);break}case G.TEXT:{are(this,t);break}case G.IN_TABLE_TEXT:{Gu(this,t);break}case G.IN_TEMPLATE:{OD(this,t);break}case G.AFTER_BODY:case G.IN_FRAMESET:case G.AFTER_FRAMESET:case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{Hv(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===H.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case G.IN_HEAD:case G.IN_HEAD_NO_SCRIPT:case G.AFTER_HEAD:case G.TEXT:case G.IN_COLUMN_GROUP:case G.IN_SELECT:case G.IN_SELECT_IN_TABLE:case G.IN_FRAMESET:case G.AFTER_FRAMESET:{this._insertCharacters(t);break}case G.IN_BODY:case G.IN_CAPTION:case G.IN_CELL:case G.IN_TEMPLATE:case G.AFTER_BODY:case G.AFTER_AFTER_BODY:case G.AFTER_AFTER_FRAMESET:{xD(this,t);break}case G.IN_TABLE:case G.IN_TABLE_BODY:case G.IN_ROW:{cb(this,t);break}case G.IN_TABLE_TEXT:{SD(this,t);break}}}};function rne(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):kD(e,t),n}function sne(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function ine(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),c=o&&i>=tne;!o||c?(c&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=ane(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function ane(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function one(e,t,n){const r=e.treeAdapter.getTagName(t),s=pu(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===v.TEMPLATE&&i===ke.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function lne(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function $v(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function dne(e,t){e._setDocumentType(t);const n=t.forceQuirks?Is.QUIRKS:$te(t);Ute(t)||e._err(t,pe.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=G.BEFORE_HTML}function Yu(e,t){e._err(t,pe.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Is.QUIRKS),e.insertionMode=G.BEFORE_HTML,e._processToken(t)}function fne(e,t){t.tagID===v.HTML?(e._insertElement(t,ke.HTML),e.insertionMode=G.BEFORE_HEAD):Pd(e,t)}function hne(e,t){const n=t.tagID;(n===v.HTML||n===v.HEAD||n===v.BODY||n===v.BR)&&Pd(e,t)}function Pd(e,t){e._insertFakeRootElement(),e.insertionMode=G.BEFORE_HEAD,e._processToken(t)}function pne(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.HEAD:{e._insertElement(t,ke.HTML),e.headElement=e.openElements.current,e.insertionMode=G.IN_HEAD;break}default:Bd(e,t)}}function mne(e,t){const n=t.tagID;n===v.HEAD||n===v.BODY||n===v.HTML||n===v.BR?Bd(e,t):e._err(t,pe.endTagWithoutMatchingOpenElement)}function Bd(e,t){e._insertFakeElement(se.HEAD,v.HEAD),e.headElement=e.openElements.current,e.insertionMode=G.IN_HEAD,e._processToken(t)}function mi(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:{e._appendElement(t,ke.HTML),t.ackSelfClosing=!0;break}case v.TITLE:{e._switchToTextParsing(t,Pn.RCDATA);break}case v.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Pn.RAWTEXT):(e._insertElement(t,ke.HTML),e.insertionMode=G.IN_HEAD_NO_SCRIPT);break}case v.NOFRAMES:case v.STYLE:{e._switchToTextParsing(t,Pn.RAWTEXT);break}case v.SCRIPT:{e._switchToTextParsing(t,Pn.SCRIPT_DATA);break}case v.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=G.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(G.IN_TEMPLATE);break}case v.HEAD:{e._err(t,pe.misplacedStartTagForHeadElement);break}default:Fd(e,t)}}function gne(e,t){switch(t.tagID){case v.HEAD:{e.openElements.pop(),e.insertionMode=G.AFTER_HEAD;break}case v.BODY:case v.BR:case v.HTML:{Fd(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function yl(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==v.TEMPLATE&&e._err(t,pe.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,pe.endTagWithoutMatchingOpenElement)}function Fd(e,t){e.openElements.pop(),e.insertionMode=G.AFTER_HEAD,e._processToken(t)}function yne(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BASEFONT:case v.BGSOUND:case v.HEAD:case v.LINK:case v.META:case v.NOFRAMES:case v.STYLE:{mi(e,t);break}case v.NOSCRIPT:{e._err(t,pe.nestedNoscriptInHead);break}default:Ud(e,t)}}function bne(e,t){switch(t.tagID){case v.NOSCRIPT:{e.openElements.pop(),e.insertionMode=G.IN_HEAD;break}case v.BR:{Ud(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function Ud(e,t){const n=t.type===Nt.EOF?pe.openElementsLeftAfterEof:pe.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=G.IN_HEAD,e._processToken(t)}function Ene(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.BODY:{e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=G.IN_BODY;break}case v.FRAMESET:{e._insertElement(t,ke.HTML),e.insertionMode=G.IN_FRAMESET;break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{e._err(t,pe.abandonedHeadElementChild),e.openElements.push(e.headElement,v.HEAD),mi(e,t),e.openElements.remove(e.headElement);break}case v.HEAD:{e._err(t,pe.misplacedStartTagForHeadElement);break}default:$d(e,t)}}function xne(e,t){switch(t.tagID){case v.BODY:case v.HTML:case v.BR:{$d(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:e._err(t,pe.endTagWithoutMatchingOpenElement)}}function $d(e,t){e._insertFakeElement(se.BODY,v.BODY),e.insertionMode=G.IN_BODY,d0(e,t)}function d0(e,t){switch(t.type){case Nt.CHARACTER:{wD(e,t);break}case Nt.WHITESPACE_CHARACTER:{xD(e,t);break}case Nt.COMMENT:{BE(e,t);break}case Nt.START_TAG:{Tr(e,t);break}case Nt.END_TAG:{f0(e,t);break}case Nt.EOF:{ND(e,t);break}}}function xD(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function wD(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function wne(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function vne(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function _ne(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_FRAMESET)}function kne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML)}function Nne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&PE.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ke.HTML)}function Sne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Tne(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),n||(e.formElement=e.openElements.current))}function Ane(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===v.LI&&s===v.LI||(n===v.DD||n===v.DT)&&(s===v.DD||s===v.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==v.ADDRESS&&s!==v.DIV&&s!==v.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML)}function Cne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.tokenizer.state=Pn.PLAINTEXT}function Ine(e,t){e.openElements.hasInScope(v.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(v.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.framesetOk=!1}function Rne(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(se.A);n&&($v(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function One(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Lne(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(v.NOBR)&&($v(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ke.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Mne(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function jne(e,t){e.treeAdapter.getDocumentMode(e.document)!==Is.QUIRKS&&e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=G.IN_TABLE}function vD(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ke.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function _D(e){const t=dD(e,Go.TYPE);return t!=null&&t.toLowerCase()===Jte}function Dne(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ke.HTML),_D(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Pne(e,t){e._appendElement(t,ke.HTML),t.ackSelfClosing=!0}function Bne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._appendElement(t,ke.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Fne(e,t){t.tagName=se.IMG,t.tagID=v.IMG,vD(e,t)}function Une(e,t){e._insertElement(t,ke.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Pn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=G.TEXT}function $ne(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Pn.RAWTEXT)}function Hne(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Pn.RAWTEXT)}function O2(e,t){e._switchToTextParsing(t,Pn.RAWTEXT)}function zne(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===G.IN_TABLE||e.insertionMode===G.IN_CAPTION||e.insertionMode===G.IN_TABLE_BODY||e.insertionMode===G.IN_ROW||e.insertionMode===G.IN_CELL?G.IN_SELECT_IN_TABLE:G.IN_SELECT}function Vne(e,t){e.openElements.currentTagId===v.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML)}function Kne(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ke.HTML)}function Yne(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(v.RTC),e._insertElement(t,ke.HTML)}function Gne(e,t){e._reconstructActiveFormattingElements(),yD(t),Uv(t),t.selfClosing?e._appendElement(t,ke.MATHML):e._insertElement(t,ke.MATHML),t.ackSelfClosing=!0}function Wne(e,t){e._reconstructActiveFormattingElements(),bD(t),Uv(t),t.selfClosing?e._appendElement(t,ke.SVG):e._insertElement(t,ke.SVG),t.ackSelfClosing=!0}function L2(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ke.HTML)}function Tr(e,t){switch(t.tagID){case v.I:case v.S:case v.B:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.SMALL:case v.STRIKE:case v.STRONG:{One(e,t);break}case v.A:{Rne(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{Nne(e,t);break}case v.P:case v.DL:case v.OL:case v.UL:case v.DIV:case v.DIR:case v.NAV:case v.MAIN:case v.MENU:case v.ASIDE:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.DETAILS:case v.ADDRESS:case v.ARTICLE:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{kne(e,t);break}case v.LI:case v.DD:case v.DT:{Ane(e,t);break}case v.BR:case v.IMG:case v.WBR:case v.AREA:case v.EMBED:case v.KEYGEN:{vD(e,t);break}case v.HR:{Bne(e,t);break}case v.RB:case v.RTC:{Kne(e,t);break}case v.RT:case v.RP:{Yne(e,t);break}case v.PRE:case v.LISTING:{Sne(e,t);break}case v.XMP:{$ne(e,t);break}case v.SVG:{Wne(e,t);break}case v.HTML:{wne(e,t);break}case v.BASE:case v.LINK:case v.META:case v.STYLE:case v.TITLE:case v.SCRIPT:case v.BGSOUND:case v.BASEFONT:case v.TEMPLATE:{mi(e,t);break}case v.BODY:{vne(e,t);break}case v.FORM:{Tne(e,t);break}case v.NOBR:{Lne(e,t);break}case v.MATH:{Gne(e,t);break}case v.TABLE:{jne(e,t);break}case v.INPUT:{Dne(e,t);break}case v.PARAM:case v.TRACK:case v.SOURCE:{Pne(e,t);break}case v.IMAGE:{Fne(e,t);break}case v.BUTTON:{Ine(e,t);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{Mne(e,t);break}case v.IFRAME:{Hne(e,t);break}case v.SELECT:{zne(e,t);break}case v.OPTION:case v.OPTGROUP:{Vne(e,t);break}case v.NOEMBED:case v.NOFRAMES:{O2(e,t);break}case v.FRAMESET:{_ne(e,t);break}case v.TEXTAREA:{Une(e,t);break}case v.NOSCRIPT:{e.options.scriptingEnabled?O2(e,t):L2(e,t);break}case v.PLAINTEXT:{Cne(e,t);break}case v.COL:case v.TH:case v.TD:case v.TR:case v.HEAD:case v.FRAME:case v.TBODY:case v.TFOOT:case v.THEAD:case v.CAPTION:case v.COLGROUP:break;default:L2(e,t)}}function qne(e,t){if(e.openElements.hasInScope(v.BODY)&&(e.insertionMode=G.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Xne(e,t){e.openElements.hasInScope(v.BODY)&&(e.insertionMode=G.AFTER_BODY,LD(e,t))}function Qne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Zne(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(v.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(v.FORM):n&&e.openElements.remove(n))}function Jne(e){e.openElements.hasInButtonScope(v.P)||e._insertFakeElement(se.P,v.P),e._closePElement()}function ere(e){e.openElements.hasInListItemScope(v.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(v.LI),e.openElements.popUntilTagNamePopped(v.LI))}function tre(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function nre(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function rre(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function sre(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(se.BR,v.BR),e.openElements.pop(),e.framesetOk=!1}function kD(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==v.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function f0(e,t){switch(t.tagID){case v.A:case v.B:case v.I:case v.S:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.NOBR:case v.SMALL:case v.STRIKE:case v.STRONG:{$v(e,t);break}case v.P:{Jne(e);break}case v.DL:case v.UL:case v.OL:case v.DIR:case v.DIV:case v.NAV:case v.PRE:case v.MAIN:case v.MENU:case v.ASIDE:case v.BUTTON:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.ADDRESS:case v.ARTICLE:case v.DETAILS:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.LISTING:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{Qne(e,t);break}case v.LI:{ere(e);break}case v.DD:case v.DT:{tre(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{nre(e);break}case v.BR:{sre(e);break}case v.BODY:{qne(e,t);break}case v.HTML:{Xne(e,t);break}case v.FORM:{Zne(e);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{rre(e,t);break}case v.TEMPLATE:{yl(e,t);break}default:kD(e,t)}}function ND(e,t){e.tmplInsertionModeStack.length>0?OD(e,t):Hv(e,t)}function ire(e,t){var n;t.tagID===v.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function are(e,t){e._err(t,pe.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function cb(e,t){if(e.openElements.currentTagId!==void 0&&ED.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=G.IN_TABLE_TEXT,t.type){case Nt.CHARACTER:{TD(e,t);break}case Nt.WHITESPACE_CHARACTER:{SD(e,t);break}}else nh(e,t)}function ore(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_CAPTION}function lre(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_COLUMN_GROUP}function cre(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.COLGROUP,v.COLGROUP),e.insertionMode=G.IN_COLUMN_GROUP,zv(e,t)}function ure(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ke.HTML),e.insertionMode=G.IN_TABLE_BODY}function dre(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.TBODY,v.TBODY),e.insertionMode=G.IN_TABLE_BODY,h0(e,t)}function fre(e,t){e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function hre(e,t){_D(t)?e._appendElement(t,ke.HTML):nh(e,t),t.ackSelfClosing=!0}function pre(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ke.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Kc(e,t){switch(t.tagID){case v.TD:case v.TH:case v.TR:{dre(e,t);break}case v.STYLE:case v.SCRIPT:case v.TEMPLATE:{mi(e,t);break}case v.COL:{cre(e,t);break}case v.FORM:{pre(e,t);break}case v.TABLE:{fre(e,t);break}case v.TBODY:case v.TFOOT:case v.THEAD:{ure(e,t);break}case v.INPUT:{hre(e,t);break}case v.CAPTION:{ore(e,t);break}case v.COLGROUP:{lre(e,t);break}default:nh(e,t)}}function Nf(e,t){switch(t.tagID){case v.TABLE:{e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode());break}case v.TEMPLATE:{yl(e,t);break}case v.BODY:case v.CAPTION:case v.COL:case v.COLGROUP:case v.HTML:case v.TBODY:case v.TD:case v.TFOOT:case v.TH:case v.THEAD:case v.TR:break;default:nh(e,t)}}function nh(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,d0(e,t),e.fosterParentingEnabled=n}function SD(e,t){e.pendingCharacterTokens.push(t)}function TD(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Gu(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===v.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===v.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===v.OPTGROUP&&e.openElements.pop();break}case v.OPTION:{e.openElements.currentTagId===v.OPTION&&e.openElements.pop();break}case v.SELECT:{e.openElements.hasInSelectScope(v.SELECT)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode());break}case v.TEMPLATE:{yl(e,t);break}}}function xre(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e._processStartTag(t)):ID(e,t)}function wre(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e.onEndTag(t)):RD(e,t)}function vre(e,t){switch(t.tagID){case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{mi(e,t);break}case v.CAPTION:case v.COLGROUP:case v.TBODY:case v.TFOOT:case v.THEAD:{e.tmplInsertionModeStack[0]=G.IN_TABLE,e.insertionMode=G.IN_TABLE,Kc(e,t);break}case v.COL:{e.tmplInsertionModeStack[0]=G.IN_COLUMN_GROUP,e.insertionMode=G.IN_COLUMN_GROUP,zv(e,t);break}case v.TR:{e.tmplInsertionModeStack[0]=G.IN_TABLE_BODY,e.insertionMode=G.IN_TABLE_BODY,h0(e,t);break}case v.TD:case v.TH:{e.tmplInsertionModeStack[0]=G.IN_ROW,e.insertionMode=G.IN_ROW,p0(e,t);break}default:e.tmplInsertionModeStack[0]=G.IN_BODY,e.insertionMode=G.IN_BODY,Tr(e,t)}}function _re(e,t){t.tagID===v.TEMPLATE&&yl(e,t)}function OD(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):Hv(e,t)}function kre(e,t){t.tagID===v.HTML?Tr(e,t):ng(e,t)}function LD(e,t){var n;if(t.tagID===v.HTML){if(e.fragmentContext||(e.insertionMode=G.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===v.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else ng(e,t)}function ng(e,t){e.insertionMode=G.IN_BODY,d0(e,t)}function Nre(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.FRAMESET:{e._insertElement(t,ke.HTML);break}case v.FRAME:{e._appendElement(t,ke.HTML),t.ackSelfClosing=!0;break}case v.NOFRAMES:{mi(e,t);break}}}function Sre(e,t){t.tagID===v.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==v.FRAMESET&&(e.insertionMode=G.AFTER_FRAMESET))}function Tre(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.NOFRAMES:{mi(e,t);break}}}function Are(e,t){t.tagID===v.HTML&&(e.insertionMode=G.AFTER_AFTER_FRAMESET)}function Cre(e,t){t.tagID===v.HTML?Tr(e,t):Jp(e,t)}function Jp(e,t){e.insertionMode=G.IN_BODY,d0(e,t)}function Ire(e,t){switch(t.tagID){case v.HTML:{Tr(e,t);break}case v.NOFRAMES:{mi(e,t);break}}}function Rre(e,t){t.chars=mn,e._insertCharacters(t)}function Ore(e,t){e._insertCharacters(t),e.framesetOk=!1}function MD(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ke.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Lre(e,t){if(Wte(t))MD(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ke.MATHML?yD(t):r===ke.SVG&&(qte(t),bD(t)),Uv(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Mre(e,t){if(t.tagID===v.P||t.tagID===v.BR){MD(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ke.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}se.AREA,se.BASE,se.BASEFONT,se.BGSOUND,se.BR,se.COL,se.EMBED,se.FRAME,se.HR,se.IMG,se.INPUT,se.KEYGEN,se.LINK,se.META,se.PARAM,se.SOURCE,se.TRACK,se.WBR;const jre=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Dre=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),M2={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function jD(e,t){const n=Yre(e),r=X3("type",{handlers:{root:Pre,element:Bre,text:Fre,comment:PD,doctype:Ure,raw:Hre},unknown:zre}),s={parser:n?new R2(M2):R2.getFragmentParser(void 0,M2),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),mu(s,Bi());const i=n?s.parser.document:s.parser.getFragment(),a=Gee(i,{file:s.options.file});return s.stitches&&eh(a,"comment",function(o,c,u){const d=o;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function DD(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Nt.CHARACTER,chars:e.value,location:rh(e)};mu(t,Bi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Ure(e,t){const n={type:Nt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:rh(e)};mu(t,Bi(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function $re(e,t){t.stitches=!0;const n=Gre(e);if("children"in e&&"children"in n){const r=jD({type:"root",children:e.children},t.options);n.children=r.children}PD({type:"comment",value:{stitch:n}},t)}function PD(e,t){const n=e.value,r={type:Nt.COMMENT,data:n,location:rh(e)};mu(t,Bi(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function Hre(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,BD(t,Bi(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(jre,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function zre(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))$re(n,t);else{let r="";throw Dre.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function mu(e,t){BD(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Pn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function BD(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Vre(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Pn.PLAINTEXT)return;mu(t,Bi(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:Bo.html;s===Bo.html&&n==="svg"&&(s=Bo.svg);const i=Zee({...e,children:[]},{space:s===Bo.svg?"svg":"html"}),a={type:Nt.START_TAG,tagName:n,tagID:pu(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:rh(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Kre(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&ate.includes(n)||t.parser.tokenizer.state===Pn.PLAINTEXT)return;mu(t,i0(e));const r={type:Nt.END_TAG,tagName:n,tagID:pu(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:rh(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Pn.RCDATA||t.parser.tokenizer.state===Pn.RAWTEXT||t.parser.tokenizer.state===Pn.SCRIPT_DATA)&&(t.parser.tokenizer.state=Pn.DATA)}function Yre(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function rh(e){const t=Bi(e)||{line:void 0,column:void 0,offset:void 0},n=i0(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function Gre(e){return"children"in e?zc({...e,children:[]}):zc(e)}function Wre(e){return function(t,n){return jD(t,{...e,file:n})}}const FD=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function UD(e){if(!e)return!1;try{const t=e.toLowerCase();return FD.some(n=>t.includes(n))}catch{return!1}}function qre(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(UD(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(i=>(i==null?void 0:i.value)||"").join("").toLowerCase();return FD.some(i=>s.includes(i))}return!1}function Xre({text:e,className:t,allowRawHtml:n=!0}){const[r,s]=E.useState(null),i=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const g=d(m);if(g)return g}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return l.jsxs("div",{className:t?`md ${t}`:"md",children:[l.jsx(Jq,{remarkPlugins:[fZ],rehypePlugins:n?[Wre,y2]:[y2],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(UD(d)||qre(c))){const f=d,h=o(c==null?void 0:c.children);return l.jsxs("div",{className:"video-container",children:[l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>s({src:f,title:h}),children:[l.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]}),l.jsx("div",{className:"video-caption",children:l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return l.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=l.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?l.jsx(KL,{src:u,children:l.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,l.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=i({src:u},d);return h?l.jsx("div",{className:"video-container",children:l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:h}),children:[l.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(gc,{})})]})}):l.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&l.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:l.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[l.jsxs("div",{className:"video-viewer-header",children:[l.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),l.jsxs("nav",{className:"video-viewer-nav",children:[l.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:l.jsx(Jw,{})}),l.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:l.jsx(Zr,{})})]})]}),l.jsx("div",{className:"video-viewer-body",children:l.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const sh=E.memo(Xre),j2=6,D2=7,Qre={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function UE(e){return Qre[(e||"").trim().toLowerCase()]||"未知"}function P2(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function Zre(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function Jre(e){const t=e.replace(/\r\n/g,` `);if(!t.startsWith(`--- `))return e;const n=t.indexOf(` --- -`,4);return n>=0?t.slice(n+5).trimStart():e}function Jre({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),l.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function ese(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function B2({direction:e}){return l.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function $E(){return l.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function F2({page:e,total:t,pageSize:n,onPage:r}){const s=Math.max(1,Math.ceil(t/n));return l.jsxs("footer",{className:"skillcenter-pager",children:[l.jsxs("span",{children:["共 ",t," 项"]}),l.jsxs("div",{className:"skillcenter-pager-actions",children:[l.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:l.jsx(B2,{direction:"left"})}),l.jsxs("span",{children:[e," / ",s]}),l.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=s,"aria-label":"下一页",children:l.jsx(B2,{direction:"right"})})]})]})}function em({children:e}){return l.jsx("div",{className:"skillcenter-empty",children:e})}function tse({skill:e,space:t,region:n,detail:r,loading:s,error:i,onClose:a}){return E.useEffect(()=>{const o=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),l.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:l.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[l.jsxs("header",{className:"skill-detail-head",children:[l.jsxs("div",{className:"skill-detail-heading",children:[l.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:l.jsx(Jre,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),l.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),l.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:l.jsx(ese,{})})]}),l.jsxs("dl",{className:"skill-detail-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"技能 ID"}),l.jsx("dd",{title:e.skillId,children:e.skillId})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"版本"}),l.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:UE(e.skillStatus)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能空间"}),l.jsx("dd",{title:t.name,children:t.name})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Project"}),l.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"地域"}),l.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),l.jsxs("div",{className:"skill-detail-content",children:[l.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?l.jsxs("div",{className:"skillcenter-loading",children:[l.jsx($E,{}),"正在读取技能内容…"]}):i?l.jsx("div",{className:"skillcenter-error",children:i}):r!=null&&r.skillMd?l.jsx(sh,{text:Zre(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):l.jsx(em,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function nse(){const[e,t]=E.useState("cn-beijing"),[n,r]=E.useState([]),[s,i]=E.useState(1),[a,o]=E.useState(0),[c,u]=E.useState(!1),[d,f]=E.useState(""),[h,p]=E.useState(null),[m,g]=E.useState([]),[x,y]=E.useState(1),[w,b]=E.useState(0),[_,k]=E.useState(!1),[N,A]=E.useState(""),[S,C]=E.useState(null),[R,O]=E.useState(null),[F,q]=E.useState(!1),[L,D]=E.useState(""),T=E.useRef(0);E.useEffect(()=>{let K=!0;return u(!0),f(""),iK({region:e,page:s,pageSize:j2}).then(W=>{if(!K)return;const B=W.items||[];r(B),o(W.totalCount||0),p(ie=>B.find(Q=>Q.id===(ie==null?void 0:ie.id))||null)}).catch(W=>{K&&(r([]),o(0),p(null),f(W instanceof Error?W.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{K&&u(!1)}),()=>{K=!1}},[e,s]),E.useEffect(()=>{if(!h){g([]),b(0);return}let K=!0;return k(!0),A(""),aK(h.id,{region:e,page:x,pageSize:D2,project:h.projectName}).then(W=>{K&&(g(W.items||[]),b(W.totalCount||0))}).catch(W=>{K&&(g([]),b(0),A(W instanceof Error?W.message:"读取技能失败,请稍后重试"))}).finally(()=>{K&&k(!1)}),()=>{K=!1}},[e,h,x]);const M=K=>{K!==e&&(U(),t(K),i(1),y(1),p(null),g([]))},j=K=>{U(),p(K),y(1)},U=()=>{T.current+=1,C(null),O(null),D(""),q(!1)},I=async K=>{if(!h)return;const W=T.current+1;T.current=W,C(K),O(null),D(""),q(!0);try{const B=await oK(h.id,K.skillId,K.version,e,h.projectName);T.current===W&&O(B)}catch(B){T.current===W&&D(B instanceof Error?B.message:"读取技能详情失败,请稍后重试")}finally{T.current===W&&q(!1)}};return l.jsxs("section",{className:"skillcenter",children:[l.jsxs("div",{className:"skillcenter-browser",children:[l.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"技能空间"}),l.jsx("span",{className:"skillcenter-count-badge",children:a})]}),l.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[l.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>M("cn-beijing"),children:"北京"}),l.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>M("cn-shanghai"),children:"上海"})]})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[c&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx($E,{}),"正在读取技能空间…"]}),d?l.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?l.jsx(em,{children:"当前地域暂无可访问的技能空间"}):l.jsx("div",{className:"skillcenter-list",children:n.map(K=>l.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===K.id?"active":""}`,onClick:()=>j(K),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:K.name,children:K.name}),l.jsx("span",{className:"skillcenter-item-description",children:K.description||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${P2(K.status)}`,children:UE(K.status)}),l.jsxs("span",{className:"skillcenter-meta-text",title:K.projectName||"default",children:["Project · ",K.projectName||"default"]}),l.jsxs("span",{className:"skillcenter-meta-text",children:[K.skillCount??0," 个技能"]}),K.updatedAt&&l.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",Qre(K.updatedAt)]})]})]})},`${K.projectName||"default"}:${K.id}`))})]}),l.jsx(F2,{page:s,total:a,pageSize:j2,onPage:i})]}),l.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsx("div",{children:l.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),l.jsx("span",{children:w})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[_&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx($E,{}),"正在读取技能…"]}),N?l.jsx("div",{className:"skillcenter-error",children:N}):m.length===0&&!_?l.jsx(em,{children:"这个空间中暂无技能"}):l.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(K=>l.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void I(K),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:K.skillName,children:K.skillName}),l.jsx("span",{className:"skillcenter-item-description",children:K.skillDescription||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${P2(K.skillStatus)}`,children:UE(K.skillStatus)}),l.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",K.version||"—"]})]})]})},`${K.skillId}:${K.version}`))})]}),l.jsx(F2,{page:x,total:w,pageSize:D2,onPage:y})]}):l.jsx(em,{children:"点击 Skill 空间以查看详情"})})]}),S&&h&&l.jsx(tse,{skill:S,space:h,region:e,detail:R,loading:F,error:L,onClose:U})]})}function rse({onAdded:e,onCancel:t}){const[n,r]=E.useState(""),[s,i]=E.useState(""),[a,o]=E.useState(""),[c,u]=E.useState(!1),[d,f]=E.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await WM(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Ja(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return l.jsx("div",{className:"addagent",children:l.jsxs("div",{className:"addagent-card",children:[l.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),l.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),l.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"API Key"}),l.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:m=>i(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),l.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&l.jsx("div",{className:"addagent-error",children:d}),l.jsxs("div",{className:"addagent-actions",children:[l.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),l.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?l.jsx(Kt,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function zn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function m0(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}tm.prototype=m0.prototype={constructor:tm,on:function(e,t){var n=this._,r=ise(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$2.hasOwnProperty(t)?{space:$2[t],local:e}:e}function ose(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===HE&&t.documentElement.namespaceURI===HE?t.createElement(e):t.createElementNS(n,e)}}function lse(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $D(e){var t=g0(e);return(t.local?lse:ose)(t)}function cse(){}function Vv(e){return e==null?cse:function(){return this.querySelector(e)}}function use(e){typeof e!="function"&&(e=Vv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=b&&(b=w+1);!(k=x[b])&&++b=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function jse(e){e||(e=Dse);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;it?1:e>=t?0:NaN}function Pse(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bse(){return Array.from(this)}function Fse(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Xse:typeof t=="function"?Zse:Qse)(e,t,n??"")):Kc(this.node(),e)}function Kc(e,t){return e.style.getPropertyValue(t)||YD(e).getComputedStyle(e,null).getPropertyValue(t)}function eie(e){return function(){delete this[e]}}function tie(e,t){return function(){this[e]=t}}function nie(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rie(e,t){return arguments.length>1?this.each((t==null?eie:typeof t=="function"?nie:tie)(e,t)):this.node()[e]}function GD(e){return e.trim().split(/^|\s+/)}function Kv(e){return e.classList||new WD(e)}function WD(e){this._node=e,this._names=GD(e.getAttribute("class")||"")}WD.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qD(e,t){for(var n=Kv(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Rie(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n()=>e;function zE(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}zE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $ie(e){return!e.ctrlKey&&!e.button}function Hie(){return this.parentNode}function zie(e,t){return t??{x:e.x,y:e.y}}function Vie(){return navigator.maxTouchPoints||"ontouchstart"in this}function tP(){var e=$ie,t=Hie,n=zie,r=Vie,s={},i=m0("start","drag","end"),a=0,o,c,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",x).on("touchmove.drag",y,Uie).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var N=b(this,t.call(this,_,k),_,k,"mouse");N&&(ls(_.view).on("mousemove.drag",m,Sf).on("mouseup.drag",g,Sf),JD(_.view),ub(_),u=!1,o=_.clientX,c=_.clientY,N("start",_))}}function m(_){if(Ec(_),!u){var k=_.clientX-o,N=_.clientY-c;u=k*k+N*N>f}s.mouse("drag",_)}function g(_){ls(_.view).on("mousemove.drag mouseup.drag",null),eP(_.view,u),Ec(_),s.mouse("end",_)}function x(_,k){if(e.call(this,_,k)){var N=_.changedTouches,A=t.call(this,_,k),S=N.length,C,R;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Yie.exec(e))?new Gr(t[1],t[2],t[3],1):(t=Gie.exec(e))?new Gr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wie.exec(e))?pp(t[1],t[2],t[3],t[4]):(t=qie.exec(e))?pp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Xie.exec(e))?W2(t[1],t[2]/100,t[3]/100,1):(t=Qie.exec(e))?W2(t[1],t[2]/100,t[3]/100,t[4]):H2.hasOwnProperty(e)?K2(H2[e]):e==="transparent"?new Gr(NaN,NaN,NaN,0):null}function K2(e){return new Gr(e>>16&255,e>>8&255,e&255,1)}function pp(e,t,n,r){return r<=0&&(e=t=n=NaN),new Gr(e,t,n,r)}function eae(e){return e instanceof ah||(e=il(e)),e?(e=e.rgb(),new Gr(e.r,e.g,e.b,e.opacity)):new Gr}function VE(e,t,n,r){return arguments.length===1?eae(e):new Gr(e,t,n,r??1)}function Gr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Yv(Gr,VE,nP(ah,{brighter(e){return e=e==null?sg:Math.pow(sg,e),new Gr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tf:Math.pow(Tf,e),new Gr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gr(Wo(this.r),Wo(this.g),Wo(this.b),ig(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Y2,formatHex:Y2,formatHex8:tae,formatRgb:G2,toString:G2}));function Y2(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}`}function tae(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}${Fo((isNaN(this.opacity)?1:this.opacity)*255)}`}function G2(){const e=ig(this.opacity);return`${e===1?"rgb(":"rgba("}${Wo(this.r)}, ${Wo(this.g)}, ${Wo(this.b)}${e===1?")":`, ${e})`}`}function ig(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fo(e){return e=Wo(e),(e<16?"0":"")+e.toString(16)}function W2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ri(e,t,n,r)}function rP(e){if(e instanceof ri)return new ri(e.h,e.s,e.l,e.opacity);if(e instanceof ah||(e=il(e)),!e)return new ri;if(e instanceof ri)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,o=i-s,c=(i+s)/2;return o?(t===i?a=(n-r)/o+(n0&&c<1?0:a,new ri(a,o,c,e.opacity)}function nae(e,t,n,r){return arguments.length===1?rP(e):new ri(e,t,n,r??1)}function ri(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Yv(ri,nae,nP(ah,{brighter(e){return e=e==null?sg:Math.pow(sg,e),new ri(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tf:Math.pow(Tf,e),new ri(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Gr(db(e>=240?e-240:e+120,s,r),db(e,s,r),db(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new ri(q2(this.h),mp(this.s),mp(this.l),ig(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ig(this.opacity);return`${e===1?"hsl(":"hsla("}${q2(this.h)}, ${mp(this.s)*100}%, ${mp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function q2(e){return e=(e||0)%360,e<0?e+360:e}function mp(e){return Math.max(0,Math.min(1,e||0))}function db(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Gv=e=>()=>e;function rae(e,t){return function(n){return e+n*t}}function sae(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function iae(e){return(e=+e)==1?sP:function(t,n){return n-t?sae(t,n,e):Gv(isNaN(t)?n:t)}}function sP(e,t){var n=t-e;return n?rae(e,n):Gv(isNaN(e)?t:e)}const ag=function e(t){var n=iae(t);function r(s,i){var a=n((s=VE(s)).r,(i=VE(i)).r),o=n(s.g,i.g),c=n(s.b,i.b),u=sP(s.opacity,i.opacity);return function(d){return s.r=a(d),s.g=o(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function aae(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,c.push({i:a,x:Ai(r,s)})),n=fb.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Ai(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Ai(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Ai(u,f)},{i:g-2,x:Ai(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,g=h.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Yc}function Z2(){al=(lg=Cf.now())+y0,Yc=ud=0;try{wae()}finally{Yc=0,_ae(),al=0}}function vae(){var e=Cf.now(),t=e-lg;t>lP&&(y0-=t,lg=e)}function _ae(){for(var e,t=og,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:og=n);dd=e,GE(r)}function GE(e){if(!Yc){ud&&(ud=clearTimeout(ud));var t=e-al;t>24?(e<1/0&&(ud=setTimeout(Z2,e-Cf.now()-y0)),Gu&&(Gu=clearInterval(Gu))):(Gu||(lg=Cf.now(),Gu=setInterval(vae,lP)),Yc=1,cP(Z2))}}function J2(e,t,n){var r=new cg;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var kae=m0("start","end","cancel","interrupt"),Nae=[],dP=0,eA=1,WE=2,rm=3,tA=4,qE=5,sm=6;function b0(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Sae(e,n,{name:t,index:r,group:s,on:kae,tween:Nae,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:dP})}function qv(e,t){var n=gi(e,t);if(n.state>dP)throw new Error("too late; already scheduled");return n}function Ui(e,t){var n=gi(e,t);if(n.state>rm)throw new Error("too late; already running");return n}function gi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Sae(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=uP(i,0,n.time);function i(u){n.state=eA,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==eA)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===rm)return J2(a);p.state===tA?(p.state=sm,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dWE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function noe(e,t,n){var r,s,i=toe(t)?qv:Ui;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(t,n),a.on=s}}function roe(e,t){var n=this._id;return arguments.length<2?gi(this.node(),n).on.on(e):this.each(noe(n,e,t))}function soe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ioe(){return this.on("end.remove",soe(this._id))}function aoe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function Roe(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function ra(e,t,n){this.k=e,this.x=t,this.y=n}ra.prototype={constructor:ra,scale:function(e){return e===1?this:new ra(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ra(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var E0=new ra(1,0,0);mP.prototype=ra.prototype;function mP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return E0;return e.__zoom}function hb(e){e.stopImmediatePropagation()}function Wu(e){e.preventDefault(),e.stopImmediatePropagation()}function Ooe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Loe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function nA(){return this.__zoom||E0}function Moe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function joe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Doe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function gP(){var e=Ooe,t=Loe,n=Doe,r=Moe,s=joe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=nm,u=m0("start","zoom","end"),d,f,h,p=500,m=150,g=0,x=10;function y(L){L.property("__zoom",nA).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",R).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(L,D,T,M){var j=L.selection?L.selection():L;j.property("__zoom",nA),L!==j?k(L,D,T,M):j.interrupt().each(function(){N(this,arguments).event(M).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},y.scaleBy=function(L,D,T,M){y.scaleTo(L,function(){var j=this.__zoom.k,U=typeof D=="function"?D.apply(this,arguments):D;return j*U},T,M)},y.scaleTo=function(L,D,T,M){y.transform(L,function(){var j=t.apply(this,arguments),U=this.__zoom,I=T==null?_(j):typeof T=="function"?T.apply(this,arguments):T,K=U.invert(I),W=typeof D=="function"?D.apply(this,arguments):D;return n(b(w(U,W),I,K),j,a)},T,M)},y.translateBy=function(L,D,T,M){y.transform(L,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),a)},null,M)},y.translateTo=function(L,D,T,M,j){y.transform(L,function(){var U=t.apply(this,arguments),I=this.__zoom,K=M==null?_(U):typeof M=="function"?M.apply(this,arguments):M;return n(E0.translate(K[0],K[1]).scale(I.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof T=="function"?-T.apply(this,arguments):-T),U,a)},M,j)};function w(L,D){return D=Math.max(i[0],Math.min(i[1],D)),D===L.k?L:new ra(D,L.x,L.y)}function b(L,D,T){var M=D[0]-T[0]*L.k,j=D[1]-T[1]*L.k;return M===L.x&&j===L.y?L:new ra(L.k,M,j)}function _(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function k(L,D,T,M){L.on("start.zoom",function(){N(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(M).end()}).tween("zoom",function(){var j=this,U=arguments,I=N(j,U).event(M),K=t.apply(j,U),W=T==null?_(K):typeof T=="function"?T.apply(j,U):T,B=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ie=j.__zoom,Q=typeof D=="function"?D.apply(j,U):D,ee=c(ie.invert(W).concat(B/ie.k),Q.invert(W).concat(B/Q.k));return function(ce){if(ce===1)ce=Q;else{var J=ee(ce),fe=B/J[2];ce=new ra(fe,W[0]-J[0]*fe,W[1]-J[1]*fe)}I.zoom(null,ce)}})}function N(L,D,T){return!T&&L.__zooming||new A(L,D)}function A(L,D){this.that=L,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,D),this.taps=0}A.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,D){return this.mouse&&L!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var D=ls(this.that).datum();u.call(L,this.that,new Roe(L,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),D)}};function S(L,...D){if(!e.apply(this,arguments))return;var T=N(this,D).event(L),M=this.__zoom,j=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,r.apply(this,arguments)))),U=ei(L);if(T.wheel)(T.mouse[0][0]!==U[0]||T.mouse[0][1]!==U[1])&&(T.mouse[1]=M.invert(T.mouse[0]=U)),clearTimeout(T.wheel);else{if(M.k===j)return;T.mouse=[U,M.invert(U)],im(this),T.start()}Wu(L),T.wheel=setTimeout(I,m),T.zoom("mouse",n(b(w(M,j),T.mouse[0],T.mouse[1]),T.extent,a));function I(){T.wheel=null,T.end()}}function C(L,...D){if(h||!e.apply(this,arguments))return;var T=L.currentTarget,M=N(this,D,!0).event(L),j=ls(L.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",B,!0),U=ei(L,T),I=L.clientX,K=L.clientY;JD(L.view),hb(L),M.mouse=[U,this.__zoom.invert(U)],im(this),M.start();function W(ie){if(Wu(ie),!M.moved){var Q=ie.clientX-I,ee=ie.clientY-K;M.moved=Q*Q+ee*ee>g}M.event(ie).zoom("mouse",n(b(M.that.__zoom,M.mouse[0]=ei(ie,T),M.mouse[1]),M.extent,a))}function B(ie){j.on("mousemove.zoom mouseup.zoom",null),eP(ie.view,M.moved),Wu(ie),M.event(ie).end()}}function R(L,...D){if(e.apply(this,arguments)){var T=this.__zoom,M=ei(L.changedTouches?L.changedTouches[0]:L,this),j=T.invert(M),U=T.k*(L.shiftKey?.5:2),I=n(b(w(T,U),M,j),t.apply(this,D),a);Wu(L),o>0?ls(this).transition().duration(o).call(k,I,M,L):ls(this).call(y.transform,I,M,L)}}function O(L,...D){if(e.apply(this,arguments)){var T=L.touches,M=T.length,j=N(this,D,L.changedTouches.length===M).event(L),U,I,K,W;for(hb(L),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},If=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],yP=["Enter"," ","Escape"],bP={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Gc;(function(e){e.Strict="strict",e.Loose="loose"})(Gc||(Gc={}));var qo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(qo||(qo={}));var Rf;(function(e){e.Partial="partial",e.Full="full"})(Rf||(Rf={}));const EP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ua;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ua||(Ua={}));var Wc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wc||(Wc={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));const rA={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top};function xP(e){return e===null?null:e?"valid":"invalid"}const wP=e=>"id"in e&&"source"in e&&"target"in e,Poe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),oh=(e,t=[0,0])=>{const{width:n,height:r}=ba(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Boe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Qv(s)?s:t.nodeLookup.get(s.id));const o=a?ug(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return x0(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return w0(n)},lh=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=x0(n,ug(s)),r=!0)}),r?w0(n):{x:0,y:0,width:0,height:0}},Zv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const o={...mu(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,g=Of(o,Xc(u)),x=(p??0)*(m??0),y=i&&g>0;(!u.internals.handleBounds||y||g>=x||u.dragging)&&c.push(u)}return c},Foe=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Uoe(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function $oe({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=Uoe(e,a),c=lh(o),u=e_(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function vP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",hi.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else o&&ll(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=ll(f)?ol(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",hi.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Hoe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),m=!p&&h.parentId&&a.find(g=>g.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=Foe(a,c);for(const h of c)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const qc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ol=(e={x:0,y:0},t,n)=>({x:qc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:qc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function _P(e,t,n){const{width:r,height:s}=ba(n),{x:i,y:a}=n.internals.positionAbsolute;return ol(e,[[i,a],[i+r,a+s]],t)}const sA=(e,t,n)=>en?-qc(Math.abs(e-n),1,t)/t:0,Jv=(e,t,n=15,r=40)=>{const s=sA(e.x,r,t.width-r)*n,i=sA(e.y,r,t.height-r)*n;return[s,i]},x0=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),XE=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),w0=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Xc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:oh(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},ug=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:oh(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},kP=(e,t)=>w0(x0(XE(e),XE(t))),Of=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},iA=e=>ii(e.width)&&ii(e.height)&&ii(e.x)&&ii(e.y),ii=e=>!isNaN(e)&&isFinite(e),NP=(e,t)=>(n,r)=>{},ch=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mu=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const o={x:(e-n)/s,y:(t-r)/s};return i?ch(o,a):o},Qc=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Il(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function zoe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Il(e,n),s=Il(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Il(e.top??e.y??0,n),s=Il(e.bottom??e.y??0,n),i=Il(e.left??e.x??0,t),a=Il(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Voe(e,t,n,r,s,i){const{x:a,y:o}=Qc(e,[t,n,r]),{x:c,y:u}=Qc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const e_=(e,t,n,r,s,i)=>{const a=zoe(i,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=qc(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,g=Voe(e,p,m,d,t,n),x={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-x.left+x.right,y:m-x.top+x.bottom,zoom:d}},Lf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ll(e){return e!=null&&e!=="parent"}function ba(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function t_(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function SP(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return i}function aA(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Koe(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Yoe(e){return{...bP,...e||{}}}function Hd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=ai(e),o=mu({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?ch(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const n_=e=>({width:e.offsetWidth,height:e.offsetHeight}),TP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Goe=["INPUT","SELECT","TEXTAREA"];function AP(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Goe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const CP=e=>"clientX"in e,ai=(e,t)=>{var i,a;const n=CP(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},oA=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...n_(a)}})};function IP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+o*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function bp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function lA({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ue.Left:return[t-bp(t-r,i),n];case Ue.Right:return[t+bp(r-t,i),n];case Ue.Top:return[t,n-bp(n-s,i)];case Ue.Bottom:return[t,n+bp(s-n,i)]}}function RP({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:i=Ue.Top,curvature:a=.25}){const[o,c]=lA({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=lA({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=IP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${r},${s}`,f,h,p,m]}function OP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n0}const Xoe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Qoe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Zoe=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",hi.error006()),t;const r=n.getEdgeId||Xoe;let s;return wP(e)?s={...e}:s={...e,id:r(e)},Qoe(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function LP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,o]=OP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,o]}const cA={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},Joe=({source:e,sourcePosition:t=Ue.Bottom,target:n})=>t===Ue.Left||t===Ue.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ele({source:e,sourcePosition:t=Ue.Bottom,target:n,targetPosition:r=Ue.Top,center:s,offset:i,stepPosition:a}){const o=cA[t],c=cA[r],u={x:e.x+o.x*i,y:e.y+o.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=Joe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],g,x;const y={x:0,y:0},w={x:0,y:0},[,,b,_]=OP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(g=s.x??u.x+(d.x-u.x)*a,x=s.y??(u.y+d.y)/2):(g=s.x??(u.x+d.x)/2,x=s.y??u.y+(d.y-u.y)*a);const S=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:x},{x:d.x,y:x}];o[h]===p?m=h==="x"?S:C:m=h==="x"?C:S}else{const S=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?C:S:m=o.y===p?S:C,t===r){const L=Math.abs(e[h]-n[h]);if(L<=i){const D=Math.min(i-1,i-L);o[h]===p?y[h]=(u[h]>e[h]?-1:1)*D:w[h]=(d[h]>n[h]?-1:1)*D}}if(t!==r){const L=h==="x"?"y":"x",D=o[h]===c[L],T=u[L]>d[L],M=u[L]=q?(g=(R.x+O.x)/2,x=m[0].y):(g=m[0].x,x=(R.y+O.y)/2)}const k={x:u.x+y.x,y:u.y+y.y},N={x:d.x+w.x,y:d.y+w.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...N.x!==m[m.length-1].x||N.y!==m[m.length-1].y?[N]:[],n],g,x,b,_]}function tle(e,t,n,r){const s=Math.min(uA(e,t)/2,uA(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function QE(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function rle(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=QE(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const MP=1e3,sle=10,r_={nodeOrigin:[0,0],nodeExtent:If,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ile={...r_,checkEquality:!0};function s_(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ale(e,t,n){const r=s_(r_,n);for(const s of e.values())if(s.parentId)a_(s,e,t,r);else{const i=oh(s,r.nodeOrigin),a=ll(s.extent)?s.extent:r.nodeExtent,o=ol(i,a,ba(s));s.internals.positionAbsolute=o}}function ole(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function i_(e){return e==="manual"}function ZE(e,t,n,r={}){var d,f;const s=s_(ile,r),i={i:0},a=new Map(t),o=s!=null&&s.elevateNodesOnSelect&&!i_(s.zIndexMode)?MP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=oh(h,s.nodeOrigin),g=ll(h.extent)?h.extent:s.nodeExtent,x=ol(m,g,ba(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:ole(h,p),z:jP(h,o,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&a_(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function lle(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function a_(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=s_(r_,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}lle(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*sle),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!i_(c)?MP:0,{x:h,y:p,z:m}=cle(e,d,a,o,f,c),{positionAbsolute:g}=e.internals,x=h!==g.x||p!==g.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:h,y:p}:g,z:m}})}function jP(e,t,n){const r=ii(e.zIndex)?e.zIndex:0;return i_(n)?r:r+(e.selected?t:0)}function cle(e,t,n,r,s,i){const{x:a,y:o}=t.internals.positionAbsolute,c=ba(e),u=oh(e,n),d=ll(e.extent)?ol(u,e.extent,c):u;let f=ol({x:a+d.x,y:o+d.y},r,c);e.extent==="parent"&&(f=_P(f,c,t));const h=jP(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function o_(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??Xc(c),d=kP(u,o.rect);i.set(o.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:o,parent:c},u)=>{var b;const d=c.internals.positionAbsolute,f=ba(c),h=c.origin??r,p=o.x0||m>0||y||w)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+w}}),(b=n.get(u))==null||b.forEach(_=>{e.some(k=>k.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=o_(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function dle({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function pA(e,t,n,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function DP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,d=`${i}-${o}--${s}-${a}`;pA("source",c,d,e,s,a),pA("target",c,u,e,i,o),t.set(r.id,r)}}function PP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:PP(n,t):!1}function mA(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function fle(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!PP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function pb({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(o=n.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function hle({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=ch(i,t);return{x:a.x-i.x,y:a.y-i.y}}function ple({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,g=null;function x({noDragClassName:w,handleSelector:b,domNode:_,isSelectable:k,nodeId:N,nodeClickDistance:A=0}){h=ls(_);function S({x:F,y:q}){const{nodeLookup:L,nodeExtent:D,snapGrid:T,snapToGrid:M,nodeOrigin:j,onNodeDrag:U,onSelectionDrag:I,onError:K,updateNodePositions:W}=t();i={x:F,y:q};let B=!1;const ie=o.size>1,Q=ie&&D?XE(lh(o)):null,ee=ie&&M?hle({dragItems:o,snapGrid:T,x:F,y:q}):null;for(const[ce,J]of o){if(!L.has(ce))continue;let fe={x:F-J.distance.x,y:q-J.distance.y};M&&(fe=ee?{x:Math.round(fe.x+ee.x),y:Math.round(fe.y+ee.y)}:ch(fe,T));let te=null;if(ie&&D&&!J.extent&&Q){const{positionAbsolute:Z}=J.internals,me=Z.x-Q.x+D[0][0],Ne=Z.x+J.measured.width-Q.x2+D[1][0],Ie=Z.y-Q.y+D[0][1],We=Z.y+J.measured.height-Q.y2+D[1][1];te=[[me,Ie],[Ne,We]]}const{position:ge,positionAbsolute:we}=vP({nodeId:ce,nextPosition:fe,nodeLookup:L,nodeExtent:te||D,nodeOrigin:j,onError:K});B=B||J.position.x!==ge.x||J.position.y!==ge.y,J.position=ge,J.internals.positionAbsolute=we}if(m=m||B,!!B&&(W(o,!0),g&&(r||U||!N&&I))){const[ce,J]=pb({nodeId:N,dragItems:o,nodeLookup:L});r==null||r(g,o,ce,J),U==null||U(g,ce,J),N||I==null||I(g,J)}}async function C(){if(!d)return;const{transform:F,panBy:q,autoPanSpeed:L,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(a);return}const[T,M]=Jv(u,d,L);(T!==0||M!==0)&&(i.x=(i.x??0)-T/F[2],i.y=(i.y??0)-M/F[2],await q({x:T,y:M})&&S(i)),a=requestAnimationFrame(C)}function R(F){var ie;const{nodeLookup:q,multiSelectionActive:L,nodesDraggable:D,transform:T,snapGrid:M,snapToGrid:j,selectNodesOnDrag:U,onNodeDragStart:I,onSelectionDragStart:K,unselectNodesAndEdges:W}=t();f=!0,(!U||!k)&&!L&&N&&((ie=q.get(N))!=null&&ie.selected||W()),k&&U&&N&&(e==null||e(N));const B=Hd(F.sourceEvent,{transform:T,snapGrid:M,snapToGrid:j,containerBounds:d});if(i=B,o=fle(q,D,B,N),o.size>0&&(n||I||!N&&K)){const[Q,ee]=pb({nodeId:N,dragItems:o,nodeLookup:q});n==null||n(F.sourceEvent,o,Q,ee),I==null||I(F.sourceEvent,Q,ee),N||K==null||K(F.sourceEvent,ee)}}const O=tP().clickDistance(A).on("start",F=>{const{domNode:q,nodeDragThreshold:L,transform:D,snapGrid:T,snapToGrid:M}=t();d=(q==null?void 0:q.getBoundingClientRect())||null,p=!1,m=!1,g=F.sourceEvent,L===0&&R(F),i=Hd(F.sourceEvent,{transform:D,snapGrid:T,snapToGrid:M,containerBounds:d}),u=ai(F.sourceEvent,d)}).on("drag",F=>{const{autoPanOnNodeDrag:q,transform:L,snapGrid:D,snapToGrid:T,nodeDragThreshold:M,nodeLookup:j}=t(),U=Hd(F.sourceEvent,{transform:L,snapGrid:D,snapToGrid:T,containerBounds:d});if(g=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||N&&!j.has(N))&&(p=!0),!p){if(!c&&q&&f&&(c=!0,C()),!f){const I=ai(F.sourceEvent,d),K=I.x-u.x,W=I.y-u.y;Math.sqrt(K*K+W*W)>M&&R(F)}(i.x!==U.xSnapped||i.y!==U.ySnapped)&&o&&f&&(u=ai(F.sourceEvent,d),S(U))}}).on("end",F=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:q,updateNodePositions:L,onNodeDragStop:D,onSelectionDragStop:T}=t();if(m&&(L(o,!1),m=!1),s||D||!N&&T){const[M,j]=pb({nodeId:N,dragItems:o,nodeLookup:q,dragging:!1});s==null||s(F.sourceEvent,o,M,j),D==null||D(F.sourceEvent,M,j),N||T==null||T(F.sourceEvent,j)}}}).filter(F=>{const q=F.target;return!F.button&&(!w||!mA(q,`.${w}`,_))&&(!b||mA(q,b,_))});h.call(O)}function y(){h==null||h.on(".drag",null)}return{update:x,destroy:y}}function mle(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Of(s,Xc(i))>0&&r.push(i);return r}const gle=250;function yle(e,t,n,r){var o,c;let s=[],i=1/0;const a=mle(e,n,t+gle);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=cl(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function BP(e,t,n,r,s,i=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&i?{...c,...cl(a,c,c.position,!0)}:c}function FP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ble(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const UP=()=>!0;function Ele(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:g,onConnectEnd:x,isValidConnection:y=UP,onReconnectEnd:w,updateConnection:b,getTransform:_,getFromHandle:k,autoPanSpeed:N,dragThreshold:A=1,handleDomNode:S}){const C=TP(e.target);let R=0,O;const{x:F,y:q}=ai(e),L=FP(i,S),D=o==null?void 0:o.getBoundingClientRect();let T=!1;if(!D||!L)return;const M=BP(s,L,r,c,t);if(!M)return;let j=ai(e,D),U=!1,I=null,K=!1,W=null;function B(){if(!d||!D)return;const[ge,we]=Jv(j,D,N);h({x:ge,y:we}),R=requestAnimationFrame(B)}const ie={...M,nodeId:s,type:L,position:M.position},Q=c.get(s);let ce={inProgress:!0,isValid:null,from:cl(Q,ie,Ue.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:Q,to:j,toHandle:null,toPosition:rA[ie.position],toNode:null,pointer:j};function J(){T=!0,b(ce),m==null||m(e,{nodeId:s,handleId:r,handleType:L})}A===0&&J();function fe(ge){if(!T){const{x:We,y:Ce}=ai(ge),et=We-F,Ge=Ce-q;if(!(et*et+Ge*Ge>A*A))return;J()}if(!k()||!ie){te(ge);return}const we=_();j=ai(ge,D),O=yle(mu(j,we,!1,[1,1]),n,c,ie),U||(B(),U=!0);const Z=$P(ge,{handle:O,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});W=Z.handleDomNode,I=Z.connection,K=ble(!!O,Z.isValid);const me=c.get(s),Ne=me?cl(me,ie,Ue.Left,!0):ce.from,Ie={...ce,from:Ne,isValid:K,to:Z.toHandle&&K?Qc({x:Z.toHandle.x,y:Z.toHandle.y},we):j,toHandle:Z.toHandle,toPosition:K&&Z.toHandle?Z.toHandle.position:rA[ie.position],toNode:Z.toHandle?c.get(Z.toHandle.nodeId):null,pointer:j};b(Ie),ce=Ie}function te(ge){if(!("touches"in ge&&ge.touches.length>0)){if(T){(O||W)&&I&&K&&(g==null||g(I));const{inProgress:we,...Z}=ce,me={...Z,toPosition:ce.toHandle?ce.toPosition:null};x==null||x(ge,me),i&&(w==null||w(ge,me))}p(),cancelAnimationFrame(R),U=!1,K=!1,I=null,W=null,C.removeEventListener("mousemove",fe),C.removeEventListener("mouseup",te),C.removeEventListener("touchmove",fe),C.removeEventListener("touchend",te)}}C.addEventListener("mousemove",fe),C.addEventListener("mouseup",te),C.addEventListener("touchmove",fe),C.addEventListener("touchend",te)}function $P(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:c,isValidConnection:u=UP,nodeLookup:d}){const f=i==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=ai(e),g=a.elementFromPoint(p,m),x=g!=null&&g.classList.contains(`${o}-flow__handle`)?g:h,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const w=FP(void 0,x),b=x.getAttribute("data-nodeid"),_=x.getAttribute("data-handleid"),k=x.classList.contains("connectable"),N=x.classList.contains("connectableend");if(!b||!w)return y;const A={source:f?b:r,sourceHandle:f?_:s,target:f?r:b,targetHandle:f?s:_};y.connection=A;const C=k&&N&&(n===Gc.Strict?f&&w==="source"||!f&&w==="target":b!==r||_!==s);y.isValid=C&&u(A),y.toHandle=BP(b,w,_,d,n,!0)}return y}const JE={onPointerDown:Ele,isValid:$P};function xle({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ls(e);function i({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=b.sourceEvent.ctrlKey&&Lf()?10:1,N=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,A=_[2]*Math.pow(2,N*k);t.scaleTo(A)};let g=[0,0];const x=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(g=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},y=b=>{const _=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],N=[k[0]-g[0],k[1]-g[1]];g=k;const A=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-N[0]*A,y:_[1]-N[1]*A},C=[[0,0],[c,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},C,o)},w=gP().on("start",x).on("zoom",f?y:null).on("zoom.wheel",h?m:null);s.call(w,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:ei}}const v0=e=>({x:e.x,y:e.y,zoom:e.k}),mb=({x:e,y:t,zoom:n})=>E0.translate(e,t).scale(n),rc=(e,t)=>e.target.closest(`.${t}`),HP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),wle=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,gb=(e,t=0,n=wle,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},zP=e=>{const t=e.ctrlKey&&Lf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vle({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(rc(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const x=ei(d),y=zP(d),w=f*Math.pow(2,y);r.scaleTo(n,w,x,d);return}const h=d.deltaMode===1?20:1;let p=s===qo.Vertical?0:d.deltaX*h,m=s===qo.Horizontal?0:d.deltaY*h;!Lf()&&d.shiftKey&&s!==qo.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*i,-(m/f)*i,{internal:!0});const g=v0(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,g))}}function _le({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,o=rc(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,s)}}function kle({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=v0(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Nle({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(n&&HP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,v0(i.transform)))}}function Sle({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&HP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=v0(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Tle({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var x;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(rc(f,`${u}-flow__node`)||rc(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||a||d&&!m||rc(f,o)&&m||rc(f,c)&&(!m||s&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((x=f.touches)==null?void 0:x.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&g}}function Ale({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=gP().scaleExtent([t,n]).translateExtent(r),h=ls(e).call(f);w({x:s.x,y:s.y,zoom:qc(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(zP);async function g(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?$d:nm).transform(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}function x({noWheelClassName:O,noPanClassName:F,onPaneContextMenu:q,userSelectionActive:L,panOnScroll:D,panOnDrag:T,panOnScrollMode:M,panOnScrollSpeed:j,preventScrolling:U,zoomOnPinch:I,zoomOnScroll:K,zoomOnDoubleClick:W,zoomActivationKeyPressed:B,lib:ie,onTransformChange:Q,connectionInProgress:ee,paneClickDistance:ce,selectionOnDrag:J}){L&&!u.isZoomingOrPanning&&y();const fe=D&&!B&&!L;f.clickDistance(J?1/0:!ii(ce)||ce<0?0:ce);const te=fe?vle({zoomPanValues:u,noWheelClassName:O,d3Selection:h,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:j,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):_le({noWheelClassName:O,preventScrolling:U,d3ZoomHandler:p});h.on("wheel.zoom",te,{passive:!1});const ge=kle({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",ge);const we=Nle({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!q,onPanZoom:i,onTransformChange:Q});f.on("zoom",we);const Z=Sle({zoomPanValues:u,panOnDrag:T,panOnScroll:D,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:c});f.on("end",Z);const me=Tle({zoomActivationKeyPressed:B,panOnDrag:T,zoomOnScroll:K,panOnScroll:D,zoomOnDoubleClick:W,zoomOnPinch:I,userSelectionActive:L,noPanClassName:F,noWheelClassName:O,lib:ie,connectionInProgress:ee});f.filter(me),W?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function w(O,F,q){const L=mb(O),D=f==null?void 0:f.constrain()(L,F,q);return D&&await g(D),D}async function b(O,F){const q=mb(O);return await g(q,F),q}function _(O){if(h){const F=mb(O),q=h.property("__zoom");(q.k!==O.zoom||q.x!==O.x||q.y!==O.y)&&(f==null||f.transform(h,F,null,{sync:!0}))}}function k(){const O=h?mP(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function N(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?$d:nm).scaleTo(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}async function A(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?$d:nm).scaleBy(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}function S(O){f==null||f.scaleExtent(O)}function C(O){f==null||f.translateExtent(O)}function R(O){const F=!ii(O)||O<0?0:O;f==null||f.clickDistance(F)}return{update:x,destroy:y,setViewport:b,setViewportConstrained:w,getViewport:k,scaleTo:N,scaleBy:A,setScaleExtent:S,setTranslateExtent:C,syncViewport:_,setClickDistance:R}}var Zc;(function(e){e.Line="line",e.Handle="handle"})(Zc||(Zc={}));function Cle({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,o=n-r,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(c[0]=c[0]*-1),o&&i&&(c[1]=c[1]*-1),c}function gA(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Aa(e,t){return Math.max(0,t-e)}function Ca(e,t){return Math.max(0,e-t)}function Ep(e,t,n){return Math.max(0,t-e,e-n)}function yA(e,t){return e?!t:t}function Ile(e,t,n,r,s,i,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:g,maxWidth:x,minHeight:y,maxHeight:w}=r,{x:b,y:_,width:k,height:N,aspectRatio:A}=e;let S=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const R=k+(c?-S:S),O=N+(u?-C:C),F=-i[0]*k,q=-i[1]*N;let L=Ep(R,g,x),D=Ep(O,y,w);if(a){let j=0,U=0;c&&S<0?j=Aa(b+S+F,a[0][0]):!c&&S>0&&(j=Ca(b+R+F,a[1][0])),u&&C<0?U=Aa(_+C+q,a[0][1]):!u&&C>0&&(U=Ca(_+O+q,a[1][1])),L=Math.max(L,j),D=Math.max(D,U)}if(o){let j=0,U=0;c&&S>0?j=Ca(b+S,o[0][0]):!c&&S<0&&(j=Aa(b+R,o[1][0])),u&&C>0?U=Ca(_+C,o[0][1]):!u&&C<0&&(U=Aa(_+O,o[1][1])),L=Math.max(L,j),D=Math.max(D,U)}if(s){if(d){const j=Ep(R/A,y,w)*A;if(L=Math.max(L,j),a){let U=0;!c&&!u||c&&!u&&h?U=Ca(_+q+R/A,a[1][1])*A:U=Aa(_+q+(c?S:-S)/A,a[0][1])*A,L=Math.max(L,U)}if(o){let U=0;!c&&!u||c&&!u&&h?U=Aa(_+R/A,o[1][1])*A:U=Ca(_+(c?S:-S)/A,o[0][1])*A,L=Math.max(L,U)}}if(f){const j=Ep(O*A,g,x)/A;if(D=Math.max(D,j),a){let U=0;!c&&!u||u&&!c&&h?U=Ca(b+O*A+F,a[1][0])/A:U=Aa(b+(u?C:-C)*A+F,a[0][0])/A,D=Math.max(D,U)}if(o){let U=0;!c&&!u||u&&!c&&h?U=Aa(b+O*A,o[1][0])/A:U=Ca(b+(u?C:-C)*A,o[0][0])/A,D=Math.max(D,U)}}}C=C+(C<0?D:-D),S=S+(S<0?L:-L),s&&(h?R>O*A?C=(yA(c,u)?-S:S)/A:S=(yA(c,u)?-C:C)*A:d?(C=S/A,u=c):(S=C*A,c=u));const T=c?b+S:b,M=u?_+C:_;return{width:k+(c?-S:S),height:N+(u?-C:C),x:i[0]*S*(c?-1:1)+T,y:i[1]*C*(u?-1:1)+M}}const VP={width:0,height:0,x:0,y:0},Rle={...VP,pointerX:0,pointerY:0,aspectRatio:1};function Ole(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=n[0]*i,c=n[1]*a;return[[r-o,s-c],[r+i-o,s+a-c]]}function Lle({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ls(e);let a={controlDirection:gA("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:g,shouldResize:x}){let y={...VP},w={...Rle};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:gA(u)};let b,_=null,k=[],N,A,S,C=!1;const R=tP().on("start",O=>{const{nodeLookup:F,transform:q,snapGrid:L,snapToGrid:D,nodeOrigin:T,paneDomNode:M}=n();if(b=F.get(t),!b)return;_=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:U}=Hd(O.sourceEvent,{transform:q,snapGrid:L,snapToGrid:D,containerBounds:_});y={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},w={...y,pointerX:j,pointerY:U,aspectRatio:y.width/y.height},N=void 0,A=ll(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(N=F.get(b.parentId)),N&&b.extent==="parent"&&(A=[[0,0],[N.measured.width,N.measured.height]]),k=[],S=void 0;for(const[I,K]of F)if(K.parentId===t&&(k.push({id:I,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const W=Ole(K,b,K.origin??T);S?S=[[Math.min(W[0][0],S[0][0]),Math.min(W[0][1],S[0][1])],[Math.max(W[1][0],S[1][0]),Math.max(W[1][1],S[1][1])]]:S=W}p==null||p(O,{...y})}).on("drag",O=>{const{transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D}=n(),T=Hd(O.sourceEvent,{transform:F,snapGrid:q,snapToGrid:L,containerBounds:_}),M=[];if(!b)return;const{x:j,y:U,width:I,height:K}=y,W={},B=b.origin??D,{width:ie,height:Q,x:ee,y:ce}=Ile(w,a.controlDirection,T,a.boundaries,a.keepAspectRatio,B,A,S),J=ie!==I,fe=Q!==K,te=ee!==j&&J,ge=ce!==U&&fe;if(!te&&!ge&&!J&&!fe)return;if((te||ge||B[0]===1||B[1]===1)&&(W.x=te?ee:y.x,W.y=ge?ce:y.y,y.x=W.x,y.y=W.y,k.length>0)){const Ne=ee-j,Ie=ce-U;for(const We of k)We.position={x:We.position.x-Ne+B[0]*(ie-I),y:We.position.y-Ie+B[1]*(Q-K)},M.push(We)}if((J||fe)&&(W.width=J&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:y.width,W.height=fe&&(!a.resizeDirection||a.resizeDirection==="vertical")?Q:y.height,y.width=W.width,y.height=W.height),N&&b.expandParent){const Ne=B[0]*(W.width??0);W.x&&W.x{C&&(g==null||g(O,{...y}),s==null||s({...y}),C=!1)});i.call(R)}function c(){i.on(".drag",null)}return{update:o,destroy:c}}var KP={exports:{}},YP={},GP={exports:{}},WP={};/** +`,4);return n>=0?t.slice(n+5).trimStart():e}function ese({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),l.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function tse(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function B2({direction:e}){return l.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function $E(){return l.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function F2({page:e,total:t,pageSize:n,onPage:r}){const s=Math.max(1,Math.ceil(t/n));return l.jsxs("footer",{className:"skillcenter-pager",children:[l.jsxs("span",{children:["共 ",t," 项"]}),l.jsxs("div",{className:"skillcenter-pager-actions",children:[l.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:l.jsx(B2,{direction:"left"})}),l.jsxs("span",{children:[e," / ",s]}),l.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=s,"aria-label":"下一页",children:l.jsx(B2,{direction:"right"})})]})]})}function em({children:e}){return l.jsx("div",{className:"skillcenter-empty",children:e})}function nse({skill:e,space:t,region:n,detail:r,loading:s,error:i,onClose:a}){return E.useEffect(()=>{const o=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),l.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:l.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[l.jsxs("header",{className:"skill-detail-head",children:[l.jsxs("div",{className:"skill-detail-heading",children:[l.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:l.jsx(ese,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),l.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),l.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:l.jsx(tse,{})})]}),l.jsxs("dl",{className:"skill-detail-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"技能 ID"}),l.jsx("dd",{title:e.skillId,children:e.skillId})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"版本"}),l.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:UE(e.skillStatus)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能空间"}),l.jsx("dd",{title:t.name,children:t.name})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Project"}),l.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"地域"}),l.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),l.jsxs("div",{className:"skill-detail-content",children:[l.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?l.jsxs("div",{className:"skillcenter-loading",children:[l.jsx($E,{}),"正在读取技能内容…"]}):i?l.jsx("div",{className:"skillcenter-error",children:i}):r!=null&&r.skillMd?l.jsx(sh,{text:Jre(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):l.jsx(em,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function rse(){const[e,t]=E.useState("cn-beijing"),[n,r]=E.useState([]),[s,i]=E.useState(1),[a,o]=E.useState(0),[c,u]=E.useState(!1),[d,f]=E.useState(""),[h,p]=E.useState(null),[m,g]=E.useState([]),[x,y]=E.useState(1),[w,b]=E.useState(0),[_,k]=E.useState(!1),[N,A]=E.useState(""),[S,C]=E.useState(null),[R,O]=E.useState(null),[F,q]=E.useState(!1),[L,D]=E.useState(""),T=E.useRef(0);E.useEffect(()=>{let K=!0;return u(!0),f(""),aK({region:e,page:s,pageSize:j2}).then(W=>{if(!K)return;const B=W.items||[];r(B),o(W.totalCount||0),p(ie=>B.find(Q=>Q.id===(ie==null?void 0:ie.id))||null)}).catch(W=>{K&&(r([]),o(0),p(null),f(W instanceof Error?W.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{K&&u(!1)}),()=>{K=!1}},[e,s]),E.useEffect(()=>{if(!h){g([]),b(0);return}let K=!0;return k(!0),A(""),oK(h.id,{region:e,page:x,pageSize:D2,project:h.projectName}).then(W=>{K&&(g(W.items||[]),b(W.totalCount||0))}).catch(W=>{K&&(g([]),b(0),A(W instanceof Error?W.message:"读取技能失败,请稍后重试"))}).finally(()=>{K&&k(!1)}),()=>{K=!1}},[e,h,x]);const M=K=>{K!==e&&(U(),t(K),i(1),y(1),p(null),g([]))},j=K=>{U(),p(K),y(1)},U=()=>{T.current+=1,C(null),O(null),D(""),q(!1)},I=async K=>{if(!h)return;const W=T.current+1;T.current=W,C(K),O(null),D(""),q(!0);try{const B=await lK(h.id,K.skillId,K.version,e,h.projectName);T.current===W&&O(B)}catch(B){T.current===W&&D(B instanceof Error?B.message:"读取技能详情失败,请稍后重试")}finally{T.current===W&&q(!1)}};return l.jsxs("section",{className:"skillcenter",children:[l.jsxs("div",{className:"skillcenter-browser",children:[l.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"技能空间"}),l.jsx("span",{className:"skillcenter-count-badge",children:a})]}),l.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[l.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>M("cn-beijing"),children:"北京"}),l.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>M("cn-shanghai"),children:"上海"})]})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[c&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx($E,{}),"正在读取技能空间…"]}),d?l.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?l.jsx(em,{children:"当前地域暂无可访问的技能空间"}):l.jsx("div",{className:"skillcenter-list",children:n.map(K=>l.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===K.id?"active":""}`,onClick:()=>j(K),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:K.name,children:K.name}),l.jsx("span",{className:"skillcenter-item-description",children:K.description||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${P2(K.status)}`,children:UE(K.status)}),l.jsxs("span",{className:"skillcenter-meta-text",title:K.projectName||"default",children:["Project · ",K.projectName||"default"]}),l.jsxs("span",{className:"skillcenter-meta-text",children:[K.skillCount??0," 个技能"]}),K.updatedAt&&l.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",Zre(K.updatedAt)]})]})]})},`${K.projectName||"default"}:${K.id}`))})]}),l.jsx(F2,{page:s,total:a,pageSize:j2,onPage:i})]}),l.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsx("div",{children:l.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),l.jsx("span",{children:w})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[_&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx($E,{}),"正在读取技能…"]}),N?l.jsx("div",{className:"skillcenter-error",children:N}):m.length===0&&!_?l.jsx(em,{children:"这个空间中暂无技能"}):l.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(K=>l.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void I(K),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:K.skillName,children:K.skillName}),l.jsx("span",{className:"skillcenter-item-description",children:K.skillDescription||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${P2(K.skillStatus)}`,children:UE(K.skillStatus)}),l.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",K.version||"—"]})]})]})},`${K.skillId}:${K.version}`))})]}),l.jsx(F2,{page:x,total:w,pageSize:D2,onPage:y})]}):l.jsx(em,{children:"点击 Skill 空间以查看详情"})})]}),S&&h&&l.jsx(nse,{skill:S,space:h,region:e,detail:R,loading:F,error:L,onClose:U})]})}function sse({onAdded:e,onCancel:t}){const[n,r]=E.useState(""),[s,i]=E.useState(""),[a,o]=E.useState(""),[c,u]=E.useState(!1),[d,f]=E.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await WM(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Ja(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return l.jsx("div",{className:"addagent",children:l.jsxs("div",{className:"addagent-card",children:[l.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),l.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),l.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"API Key"}),l.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:m=>i(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),l.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&l.jsx("div",{className:"addagent-error",children:d}),l.jsxs("div",{className:"addagent-actions",children:[l.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),l.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?l.jsx(Kt,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function zn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function m0(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}tm.prototype=m0.prototype={constructor:tm,on:function(e,t){var n=this._,r=ase(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),$2.hasOwnProperty(t)?{space:$2[t],local:e}:e}function lse(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===HE&&t.documentElement.namespaceURI===HE?t.createElement(e):t.createElementNS(n,e)}}function cse(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $D(e){var t=g0(e);return(t.local?cse:lse)(t)}function use(){}function Vv(e){return e==null?use:function(){return this.querySelector(e)}}function dse(e){typeof e!="function"&&(e=Vv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=b&&(b=w+1);!(k=x[b])&&++b=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Dse(e){e||(e=Pse);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;it?1:e>=t?0:NaN}function Bse(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Fse(){return Array.from(this)}function Use(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Qse:typeof t=="function"?Jse:Zse)(e,t,n??"")):Yc(this.node(),e)}function Yc(e,t){return e.style.getPropertyValue(t)||YD(e).getComputedStyle(e,null).getPropertyValue(t)}function tie(e){return function(){delete this[e]}}function nie(e,t){return function(){this[e]=t}}function rie(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sie(e,t){return arguments.length>1?this.each((t==null?tie:typeof t=="function"?rie:nie)(e,t)):this.node()[e]}function GD(e){return e.trim().split(/^|\s+/)}function Kv(e){return e.classList||new WD(e)}function WD(e){this._node=e,this._names=GD(e.getAttribute("class")||"")}WD.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function qD(e,t){for(var n=Kv(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Oie(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n()=>e;function zE(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}zE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hie(e){return!e.ctrlKey&&!e.button}function zie(){return this.parentNode}function Vie(e,t){return t??{x:e.x,y:e.y}}function Kie(){return navigator.maxTouchPoints||"ontouchstart"in this}function tP(){var e=Hie,t=zie,n=Vie,r=Kie,s={},i=m0("start","drag","end"),a=0,o,c,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",x).on("touchmove.drag",y,$ie).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var N=b(this,t.call(this,_,k),_,k,"mouse");N&&(ls(_.view).on("mousemove.drag",m,Sf).on("mouseup.drag",g,Sf),JD(_.view),ub(_),u=!1,o=_.clientX,c=_.clientY,N("start",_))}}function m(_){if(xc(_),!u){var k=_.clientX-o,N=_.clientY-c;u=k*k+N*N>f}s.mouse("drag",_)}function g(_){ls(_.view).on("mousemove.drag mouseup.drag",null),eP(_.view,u),xc(_),s.mouse("end",_)}function x(_,k){if(e.call(this,_,k)){var N=_.changedTouches,A=t.call(this,_,k),S=N.length,C,R;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Gie.exec(e))?new Gr(t[1],t[2],t[3],1):(t=Wie.exec(e))?new Gr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qie.exec(e))?pp(t[1],t[2],t[3],t[4]):(t=Xie.exec(e))?pp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Qie.exec(e))?W2(t[1],t[2]/100,t[3]/100,1):(t=Zie.exec(e))?W2(t[1],t[2]/100,t[3]/100,t[4]):H2.hasOwnProperty(e)?K2(H2[e]):e==="transparent"?new Gr(NaN,NaN,NaN,0):null}function K2(e){return new Gr(e>>16&255,e>>8&255,e&255,1)}function pp(e,t,n,r){return r<=0&&(e=t=n=NaN),new Gr(e,t,n,r)}function tae(e){return e instanceof ah||(e=il(e)),e?(e=e.rgb(),new Gr(e.r,e.g,e.b,e.opacity)):new Gr}function VE(e,t,n,r){return arguments.length===1?tae(e):new Gr(e,t,n,r??1)}function Gr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Yv(Gr,VE,nP(ah,{brighter(e){return e=e==null?sg:Math.pow(sg,e),new Gr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tf:Math.pow(Tf,e),new Gr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gr(Wo(this.r),Wo(this.g),Wo(this.b),ig(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Y2,formatHex:Y2,formatHex8:nae,formatRgb:G2,toString:G2}));function Y2(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}`}function nae(){return`#${Fo(this.r)}${Fo(this.g)}${Fo(this.b)}${Fo((isNaN(this.opacity)?1:this.opacity)*255)}`}function G2(){const e=ig(this.opacity);return`${e===1?"rgb(":"rgba("}${Wo(this.r)}, ${Wo(this.g)}, ${Wo(this.b)}${e===1?")":`, ${e})`}`}function ig(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fo(e){return e=Wo(e),(e<16?"0":"")+e.toString(16)}function W2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ri(e,t,n,r)}function rP(e){if(e instanceof ri)return new ri(e.h,e.s,e.l,e.opacity);if(e instanceof ah||(e=il(e)),!e)return new ri;if(e instanceof ri)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,o=i-s,c=(i+s)/2;return o?(t===i?a=(n-r)/o+(n0&&c<1?0:a,new ri(a,o,c,e.opacity)}function rae(e,t,n,r){return arguments.length===1?rP(e):new ri(e,t,n,r??1)}function ri(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Yv(ri,rae,nP(ah,{brighter(e){return e=e==null?sg:Math.pow(sg,e),new ri(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tf:Math.pow(Tf,e),new ri(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Gr(db(e>=240?e-240:e+120,s,r),db(e,s,r),db(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new ri(q2(this.h),mp(this.s),mp(this.l),ig(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ig(this.opacity);return`${e===1?"hsl(":"hsla("}${q2(this.h)}, ${mp(this.s)*100}%, ${mp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function q2(e){return e=(e||0)%360,e<0?e+360:e}function mp(e){return Math.max(0,Math.min(1,e||0))}function db(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Gv=e=>()=>e;function sae(e,t){return function(n){return e+n*t}}function iae(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function aae(e){return(e=+e)==1?sP:function(t,n){return n-t?iae(t,n,e):Gv(isNaN(t)?n:t)}}function sP(e,t){var n=t-e;return n?sae(e,n):Gv(isNaN(e)?t:e)}const ag=function e(t){var n=aae(t);function r(s,i){var a=n((s=VE(s)).r,(i=VE(i)).r),o=n(s.g,i.g),c=n(s.b,i.b),u=sP(s.opacity,i.opacity);return function(d){return s.r=a(d),s.g=o(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function oae(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,c.push({i:a,x:Ai(r,s)})),n=fb.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Ai(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Ai(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var g=p.push(s(p)+"scale(",null,",",null,")");m.push({i:g-4,x:Ai(u,f)},{i:g-2,x:Ai(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,g=h.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Gc}function Z2(){al=(lg=Cf.now())+y0,Gc=dd=0;try{vae()}finally{Gc=0,kae(),al=0}}function _ae(){var e=Cf.now(),t=e-lg;t>lP&&(y0-=t,lg=e)}function kae(){for(var e,t=og,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:og=n);fd=e,GE(r)}function GE(e){if(!Gc){dd&&(dd=clearTimeout(dd));var t=e-al;t>24?(e<1/0&&(dd=setTimeout(Z2,e-Cf.now()-y0)),Wu&&(Wu=clearInterval(Wu))):(Wu||(lg=Cf.now(),Wu=setInterval(_ae,lP)),Gc=1,cP(Z2))}}function J2(e,t,n){var r=new cg;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Nae=m0("start","end","cancel","interrupt"),Sae=[],dP=0,eA=1,WE=2,rm=3,tA=4,qE=5,sm=6;function b0(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Tae(e,n,{name:t,index:r,group:s,on:Nae,tween:Sae,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:dP})}function qv(e,t){var n=gi(e,t);if(n.state>dP)throw new Error("too late; already scheduled");return n}function Ui(e,t){var n=gi(e,t);if(n.state>rm)throw new Error("too late; already running");return n}function gi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Tae(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=uP(i,0,n.time);function i(u){n.state=eA,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==eA)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===rm)return J2(a);p.state===tA?(p.state=sm,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dWE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function roe(e,t,n){var r,s,i=noe(t)?qv:Ui;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(t,n),a.on=s}}function soe(e,t){var n=this._id;return arguments.length<2?gi(this.node(),n).on.on(e):this.each(roe(n,e,t))}function ioe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function aoe(){return this.on("end.remove",ioe(this._id))}function ooe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function Ooe(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function ra(e,t,n){this.k=e,this.x=t,this.y=n}ra.prototype={constructor:ra,scale:function(e){return e===1?this:new ra(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ra(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var E0=new ra(1,0,0);mP.prototype=ra.prototype;function mP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return E0;return e.__zoom}function hb(e){e.stopImmediatePropagation()}function qu(e){e.preventDefault(),e.stopImmediatePropagation()}function Loe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Moe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function nA(){return this.__zoom||E0}function joe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Doe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Poe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function gP(){var e=Loe,t=Moe,n=Poe,r=joe,s=Doe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=nm,u=m0("start","zoom","end"),d,f,h,p=500,m=150,g=0,x=10;function y(L){L.property("__zoom",nA).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",R).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(L,D,T,M){var j=L.selection?L.selection():L;j.property("__zoom",nA),L!==j?k(L,D,T,M):j.interrupt().each(function(){N(this,arguments).event(M).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},y.scaleBy=function(L,D,T,M){y.scaleTo(L,function(){var j=this.__zoom.k,U=typeof D=="function"?D.apply(this,arguments):D;return j*U},T,M)},y.scaleTo=function(L,D,T,M){y.transform(L,function(){var j=t.apply(this,arguments),U=this.__zoom,I=T==null?_(j):typeof T=="function"?T.apply(this,arguments):T,K=U.invert(I),W=typeof D=="function"?D.apply(this,arguments):D;return n(b(w(U,W),I,K),j,a)},T,M)},y.translateBy=function(L,D,T,M){y.transform(L,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),a)},null,M)},y.translateTo=function(L,D,T,M,j){y.transform(L,function(){var U=t.apply(this,arguments),I=this.__zoom,K=M==null?_(U):typeof M=="function"?M.apply(this,arguments):M;return n(E0.translate(K[0],K[1]).scale(I.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof T=="function"?-T.apply(this,arguments):-T),U,a)},M,j)};function w(L,D){return D=Math.max(i[0],Math.min(i[1],D)),D===L.k?L:new ra(D,L.x,L.y)}function b(L,D,T){var M=D[0]-T[0]*L.k,j=D[1]-T[1]*L.k;return M===L.x&&j===L.y?L:new ra(L.k,M,j)}function _(L){return[(+L[0][0]+ +L[1][0])/2,(+L[0][1]+ +L[1][1])/2]}function k(L,D,T,M){L.on("start.zoom",function(){N(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(M).end()}).tween("zoom",function(){var j=this,U=arguments,I=N(j,U).event(M),K=t.apply(j,U),W=T==null?_(K):typeof T=="function"?T.apply(j,U):T,B=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),ie=j.__zoom,Q=typeof D=="function"?D.apply(j,U):D,ee=c(ie.invert(W).concat(B/ie.k),Q.invert(W).concat(B/Q.k));return function(ce){if(ce===1)ce=Q;else{var J=ee(ce),fe=B/J[2];ce=new ra(fe,W[0]-J[0]*fe,W[1]-J[1]*fe)}I.zoom(null,ce)}})}function N(L,D,T){return!T&&L.__zooming||new A(L,D)}function A(L,D){this.that=L,this.args=D,this.active=0,this.sourceEvent=null,this.extent=t.apply(L,D),this.taps=0}A.prototype={event:function(L){return L&&(this.sourceEvent=L),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(L,D){return this.mouse&&L!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&L!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&L!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(L){var D=ls(this.that).datum();u.call(L,this.that,new Ooe(L,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),D)}};function S(L,...D){if(!e.apply(this,arguments))return;var T=N(this,D).event(L),M=this.__zoom,j=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,r.apply(this,arguments)))),U=ei(L);if(T.wheel)(T.mouse[0][0]!==U[0]||T.mouse[0][1]!==U[1])&&(T.mouse[1]=M.invert(T.mouse[0]=U)),clearTimeout(T.wheel);else{if(M.k===j)return;T.mouse=[U,M.invert(U)],im(this),T.start()}qu(L),T.wheel=setTimeout(I,m),T.zoom("mouse",n(b(w(M,j),T.mouse[0],T.mouse[1]),T.extent,a));function I(){T.wheel=null,T.end()}}function C(L,...D){if(h||!e.apply(this,arguments))return;var T=L.currentTarget,M=N(this,D,!0).event(L),j=ls(L.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",B,!0),U=ei(L,T),I=L.clientX,K=L.clientY;JD(L.view),hb(L),M.mouse=[U,this.__zoom.invert(U)],im(this),M.start();function W(ie){if(qu(ie),!M.moved){var Q=ie.clientX-I,ee=ie.clientY-K;M.moved=Q*Q+ee*ee>g}M.event(ie).zoom("mouse",n(b(M.that.__zoom,M.mouse[0]=ei(ie,T),M.mouse[1]),M.extent,a))}function B(ie){j.on("mousemove.zoom mouseup.zoom",null),eP(ie.view,M.moved),qu(ie),M.event(ie).end()}}function R(L,...D){if(e.apply(this,arguments)){var T=this.__zoom,M=ei(L.changedTouches?L.changedTouches[0]:L,this),j=T.invert(M),U=T.k*(L.shiftKey?.5:2),I=n(b(w(T,U),M,j),t.apply(this,D),a);qu(L),o>0?ls(this).transition().duration(o).call(k,I,M,L):ls(this).call(y.transform,I,M,L)}}function O(L,...D){if(e.apply(this,arguments)){var T=L.touches,M=T.length,j=N(this,D,L.changedTouches.length===M).event(L),U,I,K,W;for(hb(L),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},If=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],yP=["Enter"," ","Escape"],bP={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Wc;(function(e){e.Strict="strict",e.Loose="loose"})(Wc||(Wc={}));var qo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(qo||(qo={}));var Rf;(function(e){e.Partial="partial",e.Full="full"})(Rf||(Rf={}));const EP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ua;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ua||(Ua={}));var qc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qc||(qc={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));const rA={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top};function xP(e){return e===null?null:e?"valid":"invalid"}const wP=e=>"id"in e&&"source"in e&&"target"in e,Boe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Qv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),oh=(e,t=[0,0])=>{const{width:n,height:r}=ba(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Foe=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Qv(s)?s:t.nodeLookup.get(s.id));const o=a?ug(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return x0(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return w0(n)},lh=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=x0(n,ug(s)),r=!0)}),r?w0(n):{x:0,y:0,width:0,height:0}},Zv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const o={...gu(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,g=Of(o,Qc(u)),x=(p??0)*(m??0),y=i&&g>0;(!u.internals.handleBounds||y||g>=x||u.dragging)&&c.push(u)}return c},Uoe=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function $oe(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Hoe({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=$oe(e,a),c=lh(o),u=e_(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function vP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",hi.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else o&&ll(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=ll(f)?ol(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",hi.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function zoe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),m=!p&&h.parentId&&a.find(g=>g.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=Uoe(a,c);for(const h of c)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Xc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ol=(e={x:0,y:0},t,n)=>({x:Xc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Xc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function _P(e,t,n){const{width:r,height:s}=ba(n),{x:i,y:a}=n.internals.positionAbsolute;return ol(e,[[i,a],[i+r,a+s]],t)}const sA=(e,t,n)=>en?-Xc(Math.abs(e-n),1,t)/t:0,Jv=(e,t,n=15,r=40)=>{const s=sA(e.x,r,t.width-r)*n,i=sA(e.y,r,t.height-r)*n;return[s,i]},x0=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),XE=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),w0=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:oh(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},ug=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Qv(e)?e.internals.positionAbsolute:oh(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},kP=(e,t)=>w0(x0(XE(e),XE(t))),Of=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},iA=e=>ii(e.width)&&ii(e.height)&&ii(e.x)&&ii(e.y),ii=e=>!isNaN(e)&&isFinite(e),NP=(e,t)=>(n,r)=>{},ch=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gu=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const o={x:(e-n)/s,y:(t-r)/s};return i?ch(o,a):o},Zc=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Il(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Voe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Il(e,n),s=Il(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Il(e.top??e.y??0,n),s=Il(e.bottom??e.y??0,n),i=Il(e.left??e.x??0,t),a=Il(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Koe(e,t,n,r,s,i){const{x:a,y:o}=Zc(e,[t,n,r]),{x:c,y:u}=Zc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const e_=(e,t,n,r,s,i)=>{const a=Voe(i,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=Xc(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,g=Koe(e,p,m,d,t,n),x={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-x.left+x.right,y:m-x.top+x.bottom,zoom:d}},Lf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ll(e){return e!=null&&e!=="parent"}function ba(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function t_(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function SP(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return i}function aA(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Yoe(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function Goe(e){return{...bP,...e||{}}}function zd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=ai(e),o=gu({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?ch(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const n_=e=>({width:e.offsetWidth,height:e.offsetHeight}),TP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Woe=["INPUT","SELECT","TEXTAREA"];function AP(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Woe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const CP=e=>"clientX"in e,ai=(e,t)=>{var i,a;const n=CP(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},oA=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...n_(a)}})};function IP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+o*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function bp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function lA({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ue.Left:return[t-bp(t-r,i),n];case Ue.Right:return[t+bp(r-t,i),n];case Ue.Top:return[t,n-bp(n-s,i)];case Ue.Bottom:return[t,n+bp(s-n,i)]}}function RP({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:i=Ue.Top,curvature:a=.25}){const[o,c]=lA({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=lA({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=IP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${r},${s}`,f,h,p,m]}function OP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n0}const Qoe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Zoe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Joe=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",hi.error006()),t;const r=n.getEdgeId||Qoe;let s;return wP(e)?s={...e}:s={...e,id:r(e)},Zoe(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function LP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,o]=OP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,o]}const cA={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},ele=({source:e,sourcePosition:t=Ue.Bottom,target:n})=>t===Ue.Left||t===Ue.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function tle({source:e,sourcePosition:t=Ue.Bottom,target:n,targetPosition:r=Ue.Top,center:s,offset:i,stepPosition:a}){const o=cA[t],c=cA[r],u={x:e.x+o.x*i,y:e.y+o.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=ele({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],g,x;const y={x:0,y:0},w={x:0,y:0},[,,b,_]=OP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(g=s.x??u.x+(d.x-u.x)*a,x=s.y??(u.y+d.y)/2):(g=s.x??(u.x+d.x)/2,x=s.y??u.y+(d.y-u.y)*a);const S=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:x},{x:d.x,y:x}];o[h]===p?m=h==="x"?S:C:m=h==="x"?C:S}else{const S=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?C:S:m=o.y===p?S:C,t===r){const L=Math.abs(e[h]-n[h]);if(L<=i){const D=Math.min(i-1,i-L);o[h]===p?y[h]=(u[h]>e[h]?-1:1)*D:w[h]=(d[h]>n[h]?-1:1)*D}}if(t!==r){const L=h==="x"?"y":"x",D=o[h]===c[L],T=u[L]>d[L],M=u[L]=q?(g=(R.x+O.x)/2,x=m[0].y):(g=m[0].x,x=(R.y+O.y)/2)}const k={x:u.x+y.x,y:u.y+y.y},N={x:d.x+w.x,y:d.y+w.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...N.x!==m[m.length-1].x||N.y!==m[m.length-1].y?[N]:[],n],g,x,b,_]}function nle(e,t,n,r){const s=Math.min(uA(e,t)/2,uA(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function QE(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function sle(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=QE(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const MP=1e3,ile=10,r_={nodeOrigin:[0,0],nodeExtent:If,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ale={...r_,checkEquality:!0};function s_(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ole(e,t,n){const r=s_(r_,n);for(const s of e.values())if(s.parentId)a_(s,e,t,r);else{const i=oh(s,r.nodeOrigin),a=ll(s.extent)?s.extent:r.nodeExtent,o=ol(i,a,ba(s));s.internals.positionAbsolute=o}}function lle(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function i_(e){return e==="manual"}function ZE(e,t,n,r={}){var d,f;const s=s_(ale,r),i={i:0},a=new Map(t),o=s!=null&&s.elevateNodesOnSelect&&!i_(s.zIndexMode)?MP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=oh(h,s.nodeOrigin),g=ll(h.extent)?h.extent:s.nodeExtent,x=ol(m,g,ba(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:lle(h,p),z:jP(h,o,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&a_(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function cle(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function a_(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=s_(r_,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}cle(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*ile),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!i_(c)?MP:0,{x:h,y:p,z:m}=ule(e,d,a,o,f,c),{positionAbsolute:g}=e.internals,x=h!==g.x||p!==g.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:h,y:p}:g,z:m}})}function jP(e,t,n){const r=ii(e.zIndex)?e.zIndex:0;return i_(n)?r:r+(e.selected?t:0)}function ule(e,t,n,r,s,i){const{x:a,y:o}=t.internals.positionAbsolute,c=ba(e),u=oh(e,n),d=ll(e.extent)?ol(u,e.extent,c):u;let f=ol({x:a+d.x,y:o+d.y},r,c);e.extent==="parent"&&(f=_P(f,c,t));const h=jP(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function o_(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??Qc(c),d=kP(u,o.rect);i.set(o.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:o,parent:c},u)=>{var b;const d=c.internals.positionAbsolute,f=ba(c),h=c.origin??r,p=o.x0||m>0||y||w)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-m+w}}),(b=n.get(u))==null||b.forEach(_=>{e.some(k=>k.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=o_(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function fle({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function pA(e,t,n,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function DP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,d=`${i}-${o}--${s}-${a}`;pA("source",c,d,e,s,a),pA("target",c,u,e,i,o),t.set(r.id,r)}}function PP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:PP(n,t):!1}function mA(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function hle(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!PP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function pb({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(o=n.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function ple({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=ch(i,t);return{x:a.x-i.x,y:a.y-i.y}}function mle({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,g=null;function x({noDragClassName:w,handleSelector:b,domNode:_,isSelectable:k,nodeId:N,nodeClickDistance:A=0}){h=ls(_);function S({x:F,y:q}){const{nodeLookup:L,nodeExtent:D,snapGrid:T,snapToGrid:M,nodeOrigin:j,onNodeDrag:U,onSelectionDrag:I,onError:K,updateNodePositions:W}=t();i={x:F,y:q};let B=!1;const ie=o.size>1,Q=ie&&D?XE(lh(o)):null,ee=ie&&M?ple({dragItems:o,snapGrid:T,x:F,y:q}):null;for(const[ce,J]of o){if(!L.has(ce))continue;let fe={x:F-J.distance.x,y:q-J.distance.y};M&&(fe=ee?{x:Math.round(fe.x+ee.x),y:Math.round(fe.y+ee.y)}:ch(fe,T));let te=null;if(ie&&D&&!J.extent&&Q){const{positionAbsolute:Z}=J.internals,me=Z.x-Q.x+D[0][0],Ne=Z.x+J.measured.width-Q.x2+D[1][0],Ie=Z.y-Q.y+D[0][1],We=Z.y+J.measured.height-Q.y2+D[1][1];te=[[me,Ie],[Ne,We]]}const{position:ge,positionAbsolute:we}=vP({nodeId:ce,nextPosition:fe,nodeLookup:L,nodeExtent:te||D,nodeOrigin:j,onError:K});B=B||J.position.x!==ge.x||J.position.y!==ge.y,J.position=ge,J.internals.positionAbsolute=we}if(m=m||B,!!B&&(W(o,!0),g&&(r||U||!N&&I))){const[ce,J]=pb({nodeId:N,dragItems:o,nodeLookup:L});r==null||r(g,o,ce,J),U==null||U(g,ce,J),N||I==null||I(g,J)}}async function C(){if(!d)return;const{transform:F,panBy:q,autoPanSpeed:L,autoPanOnNodeDrag:D}=t();if(!D){c=!1,cancelAnimationFrame(a);return}const[T,M]=Jv(u,d,L);(T!==0||M!==0)&&(i.x=(i.x??0)-T/F[2],i.y=(i.y??0)-M/F[2],await q({x:T,y:M})&&S(i)),a=requestAnimationFrame(C)}function R(F){var ie;const{nodeLookup:q,multiSelectionActive:L,nodesDraggable:D,transform:T,snapGrid:M,snapToGrid:j,selectNodesOnDrag:U,onNodeDragStart:I,onSelectionDragStart:K,unselectNodesAndEdges:W}=t();f=!0,(!U||!k)&&!L&&N&&((ie=q.get(N))!=null&&ie.selected||W()),k&&U&&N&&(e==null||e(N));const B=zd(F.sourceEvent,{transform:T,snapGrid:M,snapToGrid:j,containerBounds:d});if(i=B,o=hle(q,D,B,N),o.size>0&&(n||I||!N&&K)){const[Q,ee]=pb({nodeId:N,dragItems:o,nodeLookup:q});n==null||n(F.sourceEvent,o,Q,ee),I==null||I(F.sourceEvent,Q,ee),N||K==null||K(F.sourceEvent,ee)}}const O=tP().clickDistance(A).on("start",F=>{const{domNode:q,nodeDragThreshold:L,transform:D,snapGrid:T,snapToGrid:M}=t();d=(q==null?void 0:q.getBoundingClientRect())||null,p=!1,m=!1,g=F.sourceEvent,L===0&&R(F),i=zd(F.sourceEvent,{transform:D,snapGrid:T,snapToGrid:M,containerBounds:d}),u=ai(F.sourceEvent,d)}).on("drag",F=>{const{autoPanOnNodeDrag:q,transform:L,snapGrid:D,snapToGrid:T,nodeDragThreshold:M,nodeLookup:j}=t(),U=zd(F.sourceEvent,{transform:L,snapGrid:D,snapToGrid:T,containerBounds:d});if(g=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||N&&!j.has(N))&&(p=!0),!p){if(!c&&q&&f&&(c=!0,C()),!f){const I=ai(F.sourceEvent,d),K=I.x-u.x,W=I.y-u.y;Math.sqrt(K*K+W*W)>M&&R(F)}(i.x!==U.xSnapped||i.y!==U.ySnapped)&&o&&f&&(u=ai(F.sourceEvent,d),S(U))}}).on("end",F=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:q,updateNodePositions:L,onNodeDragStop:D,onSelectionDragStop:T}=t();if(m&&(L(o,!1),m=!1),s||D||!N&&T){const[M,j]=pb({nodeId:N,dragItems:o,nodeLookup:q,dragging:!1});s==null||s(F.sourceEvent,o,M,j),D==null||D(F.sourceEvent,M,j),N||T==null||T(F.sourceEvent,j)}}}).filter(F=>{const q=F.target;return!F.button&&(!w||!mA(q,`.${w}`,_))&&(!b||mA(q,b,_))});h.call(O)}function y(){h==null||h.on(".drag",null)}return{update:x,destroy:y}}function gle(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Of(s,Qc(i))>0&&r.push(i);return r}const yle=250;function ble(e,t,n,r){var o,c;let s=[],i=1/0;const a=gle(e,n,t+yle);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=cl(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function BP(e,t,n,r,s,i=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&i?{...c,...cl(a,c,c.position,!0)}:c}function FP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ele(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const UP=()=>!0;function xle(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:g,onConnectEnd:x,isValidConnection:y=UP,onReconnectEnd:w,updateConnection:b,getTransform:_,getFromHandle:k,autoPanSpeed:N,dragThreshold:A=1,handleDomNode:S}){const C=TP(e.target);let R=0,O;const{x:F,y:q}=ai(e),L=FP(i,S),D=o==null?void 0:o.getBoundingClientRect();let T=!1;if(!D||!L)return;const M=BP(s,L,r,c,t);if(!M)return;let j=ai(e,D),U=!1,I=null,K=!1,W=null;function B(){if(!d||!D)return;const[ge,we]=Jv(j,D,N);h({x:ge,y:we}),R=requestAnimationFrame(B)}const ie={...M,nodeId:s,type:L,position:M.position},Q=c.get(s);let ce={inProgress:!0,isValid:null,from:cl(Q,ie,Ue.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:Q,to:j,toHandle:null,toPosition:rA[ie.position],toNode:null,pointer:j};function J(){T=!0,b(ce),m==null||m(e,{nodeId:s,handleId:r,handleType:L})}A===0&&J();function fe(ge){if(!T){const{x:We,y:Ce}=ai(ge),et=We-F,Ge=Ce-q;if(!(et*et+Ge*Ge>A*A))return;J()}if(!k()||!ie){te(ge);return}const we=_();j=ai(ge,D),O=ble(gu(j,we,!1,[1,1]),n,c,ie),U||(B(),U=!0);const Z=$P(ge,{handle:O,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});W=Z.handleDomNode,I=Z.connection,K=Ele(!!O,Z.isValid);const me=c.get(s),Ne=me?cl(me,ie,Ue.Left,!0):ce.from,Ie={...ce,from:Ne,isValid:K,to:Z.toHandle&&K?Zc({x:Z.toHandle.x,y:Z.toHandle.y},we):j,toHandle:Z.toHandle,toPosition:K&&Z.toHandle?Z.toHandle.position:rA[ie.position],toNode:Z.toHandle?c.get(Z.toHandle.nodeId):null,pointer:j};b(Ie),ce=Ie}function te(ge){if(!("touches"in ge&&ge.touches.length>0)){if(T){(O||W)&&I&&K&&(g==null||g(I));const{inProgress:we,...Z}=ce,me={...Z,toPosition:ce.toHandle?ce.toPosition:null};x==null||x(ge,me),i&&(w==null||w(ge,me))}p(),cancelAnimationFrame(R),U=!1,K=!1,I=null,W=null,C.removeEventListener("mousemove",fe),C.removeEventListener("mouseup",te),C.removeEventListener("touchmove",fe),C.removeEventListener("touchend",te)}}C.addEventListener("mousemove",fe),C.addEventListener("mouseup",te),C.addEventListener("touchmove",fe),C.addEventListener("touchend",te)}function $P(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:c,isValidConnection:u=UP,nodeLookup:d}){const f=i==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=ai(e),g=a.elementFromPoint(p,m),x=g!=null&&g.classList.contains(`${o}-flow__handle`)?g:h,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const w=FP(void 0,x),b=x.getAttribute("data-nodeid"),_=x.getAttribute("data-handleid"),k=x.classList.contains("connectable"),N=x.classList.contains("connectableend");if(!b||!w)return y;const A={source:f?b:r,sourceHandle:f?_:s,target:f?r:b,targetHandle:f?s:_};y.connection=A;const C=k&&N&&(n===Wc.Strict?f&&w==="source"||!f&&w==="target":b!==r||_!==s);y.isValid=C&&u(A),y.toHandle=BP(b,w,_,d,n,!0)}return y}const JE={onPointerDown:xle,isValid:$P};function wle({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ls(e);function i({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=b.sourceEvent.ctrlKey&&Lf()?10:1,N=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,A=_[2]*Math.pow(2,N*k);t.scaleTo(A)};let g=[0,0];const x=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(g=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},y=b=>{const _=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],N=[k[0]-g[0],k[1]-g[1]];g=k;const A=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-N[0]*A,y:_[1]-N[1]*A},C=[[0,0],[c,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},C,o)},w=gP().on("start",x).on("zoom",f?y:null).on("zoom.wheel",h?m:null);s.call(w,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:ei}}const v0=e=>({x:e.x,y:e.y,zoom:e.k}),mb=({x:e,y:t,zoom:n})=>E0.translate(e,t).scale(n),rc=(e,t)=>e.target.closest(`.${t}`),HP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),vle=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,gb=(e,t=0,n=vle,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},zP=e=>{const t=e.ctrlKey&&Lf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function _le({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(rc(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const x=ei(d),y=zP(d),w=f*Math.pow(2,y);r.scaleTo(n,w,x,d);return}const h=d.deltaMode===1?20:1;let p=s===qo.Vertical?0:d.deltaX*h,m=s===qo.Horizontal?0:d.deltaY*h;!Lf()&&d.shiftKey&&s!==qo.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*i,-(m/f)*i,{internal:!0});const g=v0(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,g))}}function kle({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,o=rc(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,s)}}function Nle({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=v0(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Sle({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(n&&HP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,v0(i.transform)))}}function Tle({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&HP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=v0(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Ale({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var x;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(rc(f,`${u}-flow__node`)||rc(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||a||d&&!m||rc(f,o)&&m||rc(f,c)&&(!m||s&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((x=f.touches)==null?void 0:x.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&g}}function Cle({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=gP().scaleExtent([t,n]).translateExtent(r),h=ls(e).call(f);w({x:s.x,y:s.y,zoom:Xc(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(zP);async function g(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?Hd:nm).transform(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}function x({noWheelClassName:O,noPanClassName:F,onPaneContextMenu:q,userSelectionActive:L,panOnScroll:D,panOnDrag:T,panOnScrollMode:M,panOnScrollSpeed:j,preventScrolling:U,zoomOnPinch:I,zoomOnScroll:K,zoomOnDoubleClick:W,zoomActivationKeyPressed:B,lib:ie,onTransformChange:Q,connectionInProgress:ee,paneClickDistance:ce,selectionOnDrag:J}){L&&!u.isZoomingOrPanning&&y();const fe=D&&!B&&!L;f.clickDistance(J?1/0:!ii(ce)||ce<0?0:ce);const te=fe?_le({zoomPanValues:u,noWheelClassName:O,d3Selection:h,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:j,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):kle({noWheelClassName:O,preventScrolling:U,d3ZoomHandler:p});h.on("wheel.zoom",te,{passive:!1});const ge=Nle({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",ge);const we=Sle({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!q,onPanZoom:i,onTransformChange:Q});f.on("zoom",we);const Z=Tle({zoomPanValues:u,panOnDrag:T,panOnScroll:D,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:c});f.on("end",Z);const me=Ale({zoomActivationKeyPressed:B,panOnDrag:T,zoomOnScroll:K,panOnScroll:D,zoomOnDoubleClick:W,zoomOnPinch:I,userSelectionActive:L,noPanClassName:F,noWheelClassName:O,lib:ie,connectionInProgress:ee});f.filter(me),W?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function w(O,F,q){const L=mb(O),D=f==null?void 0:f.constrain()(L,F,q);return D&&await g(D),D}async function b(O,F){const q=mb(O);return await g(q,F),q}function _(O){if(h){const F=mb(O),q=h.property("__zoom");(q.k!==O.zoom||q.x!==O.x||q.y!==O.y)&&(f==null||f.transform(h,F,null,{sync:!0}))}}function k(){const O=h?mP(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}async function N(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?Hd:nm).scaleTo(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}async function A(O,F){return h?new Promise(q=>{f==null||f.interpolate((F==null?void 0:F.interpolate)==="linear"?Hd:nm).scaleBy(gb(h,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>q(!0)),O)}):!1}function S(O){f==null||f.scaleExtent(O)}function C(O){f==null||f.translateExtent(O)}function R(O){const F=!ii(O)||O<0?0:O;f==null||f.clickDistance(F)}return{update:x,destroy:y,setViewport:b,setViewportConstrained:w,getViewport:k,scaleTo:N,scaleBy:A,setScaleExtent:S,setTranslateExtent:C,syncViewport:_,setClickDistance:R}}var Jc;(function(e){e.Line="line",e.Handle="handle"})(Jc||(Jc={}));function Ile({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,o=n-r,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(c[0]=c[0]*-1),o&&i&&(c[1]=c[1]*-1),c}function gA(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Aa(e,t){return Math.max(0,t-e)}function Ca(e,t){return Math.max(0,e-t)}function Ep(e,t,n){return Math.max(0,t-e,e-n)}function yA(e,t){return e?!t:t}function Rle(e,t,n,r,s,i,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:g,maxWidth:x,minHeight:y,maxHeight:w}=r,{x:b,y:_,width:k,height:N,aspectRatio:A}=e;let S=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?m-e.pointerY:0);const R=k+(c?-S:S),O=N+(u?-C:C),F=-i[0]*k,q=-i[1]*N;let L=Ep(R,g,x),D=Ep(O,y,w);if(a){let j=0,U=0;c&&S<0?j=Aa(b+S+F,a[0][0]):!c&&S>0&&(j=Ca(b+R+F,a[1][0])),u&&C<0?U=Aa(_+C+q,a[0][1]):!u&&C>0&&(U=Ca(_+O+q,a[1][1])),L=Math.max(L,j),D=Math.max(D,U)}if(o){let j=0,U=0;c&&S>0?j=Ca(b+S,o[0][0]):!c&&S<0&&(j=Aa(b+R,o[1][0])),u&&C>0?U=Ca(_+C,o[0][1]):!u&&C<0&&(U=Aa(_+O,o[1][1])),L=Math.max(L,j),D=Math.max(D,U)}if(s){if(d){const j=Ep(R/A,y,w)*A;if(L=Math.max(L,j),a){let U=0;!c&&!u||c&&!u&&h?U=Ca(_+q+R/A,a[1][1])*A:U=Aa(_+q+(c?S:-S)/A,a[0][1])*A,L=Math.max(L,U)}if(o){let U=0;!c&&!u||c&&!u&&h?U=Aa(_+R/A,o[1][1])*A:U=Ca(_+(c?S:-S)/A,o[0][1])*A,L=Math.max(L,U)}}if(f){const j=Ep(O*A,g,x)/A;if(D=Math.max(D,j),a){let U=0;!c&&!u||u&&!c&&h?U=Ca(b+O*A+F,a[1][0])/A:U=Aa(b+(u?C:-C)*A+F,a[0][0])/A,D=Math.max(D,U)}if(o){let U=0;!c&&!u||u&&!c&&h?U=Aa(b+O*A,o[1][0])/A:U=Ca(b+(u?C:-C)*A,o[0][0])/A,D=Math.max(D,U)}}}C=C+(C<0?D:-D),S=S+(S<0?L:-L),s&&(h?R>O*A?C=(yA(c,u)?-S:S)/A:S=(yA(c,u)?-C:C)*A:d?(C=S/A,u=c):(S=C*A,c=u));const T=c?b+S:b,M=u?_+C:_;return{width:k+(c?-S:S),height:N+(u?-C:C),x:i[0]*S*(c?-1:1)+T,y:i[1]*C*(u?-1:1)+M}}const VP={width:0,height:0,x:0,y:0},Ole={...VP,pointerX:0,pointerY:0,aspectRatio:1};function Lle(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=n[0]*i,c=n[1]*a;return[[r-o,s-c],[r+i-o,s+a-c]]}function Mle({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=ls(e);let a={controlDirection:gA("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:g,shouldResize:x}){let y={...VP},w={...Ole};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:gA(u)};let b,_=null,k=[],N,A,S,C=!1;const R=tP().on("start",O=>{const{nodeLookup:F,transform:q,snapGrid:L,snapToGrid:D,nodeOrigin:T,paneDomNode:M}=n();if(b=F.get(t),!b)return;_=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:U}=zd(O.sourceEvent,{transform:q,snapGrid:L,snapToGrid:D,containerBounds:_});y={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},w={...y,pointerX:j,pointerY:U,aspectRatio:y.width/y.height},N=void 0,A=ll(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(N=F.get(b.parentId)),N&&b.extent==="parent"&&(A=[[0,0],[N.measured.width,N.measured.height]]),k=[],S=void 0;for(const[I,K]of F)if(K.parentId===t&&(k.push({id:I,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const W=Lle(K,b,K.origin??T);S?S=[[Math.min(W[0][0],S[0][0]),Math.min(W[0][1],S[0][1])],[Math.max(W[1][0],S[1][0]),Math.max(W[1][1],S[1][1])]]:S=W}p==null||p(O,{...y})}).on("drag",O=>{const{transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D}=n(),T=zd(O.sourceEvent,{transform:F,snapGrid:q,snapToGrid:L,containerBounds:_}),M=[];if(!b)return;const{x:j,y:U,width:I,height:K}=y,W={},B=b.origin??D,{width:ie,height:Q,x:ee,y:ce}=Rle(w,a.controlDirection,T,a.boundaries,a.keepAspectRatio,B,A,S),J=ie!==I,fe=Q!==K,te=ee!==j&&J,ge=ce!==U&&fe;if(!te&&!ge&&!J&&!fe)return;if((te||ge||B[0]===1||B[1]===1)&&(W.x=te?ee:y.x,W.y=ge?ce:y.y,y.x=W.x,y.y=W.y,k.length>0)){const Ne=ee-j,Ie=ce-U;for(const We of k)We.position={x:We.position.x-Ne+B[0]*(ie-I),y:We.position.y-Ie+B[1]*(Q-K)},M.push(We)}if((J||fe)&&(W.width=J&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:y.width,W.height=fe&&(!a.resizeDirection||a.resizeDirection==="vertical")?Q:y.height,y.width=W.width,y.height=W.height),N&&b.expandParent){const Ne=B[0]*(W.width??0);W.x&&W.x{C&&(g==null||g(O,{...y}),s==null||s({...y}),C=!1)});i.call(R)}function c(){i.on(".drag",null)}return{update:o,destroy:c}}var KP={exports:{}},YP={},GP={exports:{}},WP={};/** * @license React * use-sync-external-store-shim.production.js * @@ -554,7 +554,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),I=T,U=M),j===void 0&&( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Jc=E;function Mle(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jle=typeof Object.is=="function"?Object.is:Mle,Dle=Jc.useState,Ple=Jc.useEffect,Ble=Jc.useLayoutEffect,Fle=Jc.useDebugValue;function Ule(e,t){var n=t(),r=Dle({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Ble(function(){s.value=n,s.getSnapshot=t,yb(s)&&i({inst:s})},[e,n,t]),Ple(function(){return yb(s)&&i({inst:s}),e(function(){yb(s)&&i({inst:s})})},[e]),Fle(n),n}function yb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!jle(e,n)}catch{return!0}}function $le(e,t){return t()}var Hle=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?$le:Ule;WP.useSyncExternalStore=Jc.useSyncExternalStore!==void 0?Jc.useSyncExternalStore:Hle;GP.exports=WP;var zle=GP.exports;/** + */var eu=E;function jle(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Dle=typeof Object.is=="function"?Object.is:jle,Ple=eu.useState,Ble=eu.useEffect,Fle=eu.useLayoutEffect,Ule=eu.useDebugValue;function $le(e,t){var n=t(),r=Ple({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Fle(function(){s.value=n,s.getSnapshot=t,yb(s)&&i({inst:s})},[e,n,t]),Ble(function(){return yb(s)&&i({inst:s}),e(function(){yb(s)&&i({inst:s})})},[e]),Ule(n),n}function yb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Dle(e,n)}catch{return!0}}function Hle(e,t){return t()}var zle=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Hle:$le;WP.useSyncExternalStore=eu.useSyncExternalStore!==void 0?eu.useSyncExternalStore:zle;GP.exports=WP;var Vle=GP.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -562,22 +562,22 @@ https://github.com/highlightjs/highlight.js/issues/2277`),I=T,U=M),j===void 0&&( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var _0=E,Vle=zle;function Kle(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yle=typeof Object.is=="function"?Object.is:Kle,Gle=Vle.useSyncExternalStore,Wle=_0.useRef,qle=_0.useEffect,Xle=_0.useMemo,Qle=_0.useDebugValue;YP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=Wle(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Xle(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,Yle(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var o=Gle(e,i[0],i[1]);return qle(function(){a.hasValue=!0,a.value=o},[o]),Qle(o),o};KP.exports=YP;var Zle=KP.exports;const Jle=Bf(Zle),ece={},bA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(ece?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},tce=e=>e?bA(e):bA,{useDebugValue:nce}=wt,{useSyncExternalStoreWithSelector:rce}=Jle,sce=e=>e;function qP(e,t=sce,n){const r=rce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return nce(r),r}const EA=(e,t)=>{const n=tce(e),r=(s,i=t)=>qP(n,s,i);return Object.assign(r,n),r},ice=(e,t)=>e?EA(e,t):EA;function bn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const k0=E.createContext(null),ace=k0.Provider,XP=hi.error001("react");function Ot(e,t){const n=E.useContext(k0);if(n===null)throw new Error(XP);return qP(n,e,t)}function xn(){const e=E.useContext(k0);if(e===null)throw new Error(XP);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xA={display:"none"},oce={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},QP="react-flow__node-desc",ZP="react-flow__edge-desc",lce="react-flow__aria-live",cce=e=>e.ariaLiveMessage,uce=e=>e.ariaLabelConfig;function dce({rfId:e}){const t=Ot(cce);return l.jsx("div",{id:`${lce}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:oce,children:t})}function fce({rfId:e,disableKeyboardA11y:t}){const n=Ot(uce);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${QP}-${e}`,style:xA,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${ZP}-${e}`,style:xA,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(dce,{rfId:e})]})}const N0=E.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return l.jsx("div",{className:zn(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});N0.displayName="Panel";function hce({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(N0,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const pce=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},xp=e=>e.id;function mce(e,t){return bn(e.selectedNodes.map(xp),t.selectedNodes.map(xp))&&bn(e.selectedEdges.map(xp),t.selectedEdges.map(xp))}function gce({onSelectionChange:e}){const t=xn(),{selectedNodes:n,selectedEdges:r}=Ot(pce,mce);return E.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const yce=e=>!!e.onSelectionChangeHandlers;function bce({onSelectionChange:e}){const t=Ot(yce);return e||t?l.jsx(gce,{onSelectionChange:e}):null}const JP=[0,0],Ece={x:0,y:0,zoom:1},xce=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],wA=[...xce,"rfId"],wce=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),vA={translateExtent:If,nodeOrigin:JP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function vce(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=Ot(wce,bn),u=xn();E.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=vA,o()}),[]);const d=E.useRef(vA);return E.useEffect(()=>{for(const f of wA){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Yoe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},wA.map(f=>e[f])),null}function _A(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function _ce(e){var r;const[t,n]=E.useState(e==="system"?null:e);return E.useEffect(()=>{if(e!=="system"){n(e);return}const s=_A(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=_A())!=null&&r.matches?"dark":"light"}const kA=typeof document<"u"?document:null;function Mf(e=null,t={target:kA,actInsideInputWithModifier:!0}){const[n,r]=E.useState(!1),s=E.useRef(!1),i=E.useRef(new Set([])),[a,o]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var _0=E,Kle=Vle;function Yle(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gle=typeof Object.is=="function"?Object.is:Yle,Wle=Kle.useSyncExternalStore,qle=_0.useRef,Xle=_0.useEffect,Qle=_0.useMemo,Zle=_0.useDebugValue;YP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=qle(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Qle(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,Gle(d,p))return m;var g=r(p);return s!==void 0&&s(m,g)?(d=p,m):(d=p,f=g)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var o=Wle(e,i[0],i[1]);return Xle(function(){a.hasValue=!0,a.value=o},[o]),Zle(o),o};KP.exports=YP;var Jle=KP.exports;const ece=Bf(Jle),tce={},bA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(tce?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},nce=e=>e?bA(e):bA,{useDebugValue:rce}=wt,{useSyncExternalStoreWithSelector:sce}=ece,ice=e=>e;function qP(e,t=ice,n){const r=sce(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return rce(r),r}const EA=(e,t)=>{const n=nce(e),r=(s,i=t)=>qP(n,s,i);return Object.assign(r,n),r},ace=(e,t)=>e?EA(e,t):EA;function bn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const k0=E.createContext(null),oce=k0.Provider,XP=hi.error001("react");function Ot(e,t){const n=E.useContext(k0);if(n===null)throw new Error(XP);return qP(n,e,t)}function xn(){const e=E.useContext(k0);if(e===null)throw new Error(XP);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xA={display:"none"},lce={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},QP="react-flow__node-desc",ZP="react-flow__edge-desc",cce="react-flow__aria-live",uce=e=>e.ariaLiveMessage,dce=e=>e.ariaLabelConfig;function fce({rfId:e}){const t=Ot(uce);return l.jsx("div",{id:`${cce}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:lce,children:t})}function hce({rfId:e,disableKeyboardA11y:t}){const n=Ot(dce);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${QP}-${e}`,style:xA,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${ZP}-${e}`,style:xA,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(fce,{rfId:e})]})}const N0=E.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return l.jsx("div",{className:zn(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});N0.displayName="Panel";function pce({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(N0,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const mce=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},xp=e=>e.id;function gce(e,t){return bn(e.selectedNodes.map(xp),t.selectedNodes.map(xp))&&bn(e.selectedEdges.map(xp),t.selectedEdges.map(xp))}function yce({onSelectionChange:e}){const t=xn(),{selectedNodes:n,selectedEdges:r}=Ot(mce,gce);return E.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const bce=e=>!!e.onSelectionChangeHandlers;function Ece({onSelectionChange:e}){const t=Ot(bce);return e||t?l.jsx(yce,{onSelectionChange:e}):null}const JP=[0,0],xce={x:0,y:0,zoom:1},wce=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],wA=[...wce,"rfId"],vce=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),vA={translateExtent:If,nodeOrigin:JP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _ce(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=Ot(vce,bn),u=xn();E.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=vA,o()}),[]);const d=E.useRef(vA);return E.useEffect(()=>{for(const f of wA){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Goe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},wA.map(f=>e[f])),null}function _A(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function kce(e){var r;const[t,n]=E.useState(e==="system"?null:e);return E.useEffect(()=>{if(e!=="system"){n(e);return}const s=_A(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=_A())!=null&&r.matches?"dark":"light"}const kA=typeof document<"u"?document:null;function Mf(e=null,t={target:kA,actInsideInputWithModifier:!0}){const[n,r]=E.useState(!1),s=E.useRef(!1),i=E.useRef(new Set([])),[a,o]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return E.useEffect(()=>{const c=(t==null?void 0:t.target)??kA,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var x,y;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&AP(p))return!1;const g=SA(p.code,o);if(i.current.add(p[g]),NA(a,i.current,!1)){const w=((y=(x=p.composedPath)==null?void 0:x.call(p))==null?void 0:y[0])||p.target,b=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&p.preventDefault(),r(!0)}},f=p=>{const m=SA(p.code,o);NA(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function NA(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function SA(e,t){return t.includes(e)?"code":"key"}const kce=()=>{const e=xn();return E.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),c=e_(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return mu(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Qc(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function e4(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...i};for(const c of a)Nce(c,o);n.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Nce(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function t4(e,t){return e4(e,t)}function n4(e,t){return e4(e,t)}function Ao(e,t){return{id:e,type:"select",selected:t}}function sc(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(Ao(i.id,a)))}return r}function TA({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=t.get(a.id),c=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function AA(e){return{id:e.id,type:"remove"}}const Sce=NP();function r4(e,t,n={}){return Zoe(e,t,{...n,onError:n.onError??Sce})}const CA=e=>Poe(e),Tce=e=>wP(e);function s4(e){return E.forwardRef(e)}const Ace=typeof window<"u"?E.useLayoutEffect:E.useEffect;function IA(e){const[t,n]=E.useState(BigInt(0)),[r]=E.useState(()=>Cce(()=>n(s=>s+BigInt(1))));return Ace(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Cce(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const i4=E.createContext(null);function Ice({children:e}){const t=xn(),n=E.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let g=c;for(const y of o)g=typeof y=="function"?y(g):y;let x=TA({items:g,lookup:h});for(const y of m.values())x=y(x);d&&u(g),x.length>0?f==null||f(x):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:w,setNodes:b}=t.getState();y&&b(w)})},[]),r=IA(n),s=E.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(TA({items:p,lookup:h}))},[]),i=IA(s),a=E.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return l.jsx(i4.Provider,{value:a,children:e})}function Rce(){const e=E.useContext(i4);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Oce=e=>!!e.panZoom;function S0(){const e=kce(),t=xn(),n=Rce(),r=Ot(Oce),s=E.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var y,w;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=CA(f)?f:h.get(f.id),g=m.parentId?SP(m.position,m.measured,m.parentId,h,p):m.position,x={...m,position:g,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((w=m.measured)==null?void 0:w.height)??m.height};return Xc(x)},u=(f,h,p={replace:!1})=>{a(m=>m.map(g=>{if(g.id===f){const x=typeof h=="function"?h(g):h;return p.replace&&CA(x)?x:{...g,...x}}return g}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(g=>{if(g.id===f){const x=typeof h=="function"?h(g):h;return p.replace&&Tce(x)?x:{...g,...x}}return g}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,g,x]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:g,zoom:x}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:g,onEdgesDelete:x,triggerNodeChanges:y,triggerEdgeChanges:w,onDelete:b,onBeforeDelete:_}=t.getState(),{nodes:k,edges:N}=await Hoe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),A=N.length>0,S=k.length>0;if(A){const C=N.map(AA);x==null||x(N),w(C)}if(S){const C=k.map(AA);g==null||g(k),y(C)}return(S||A)&&(b==null||b({nodes:k,edges:N})),{deletedNodes:k,deletedEdges:N}},getIntersectingNodes:(f,h=!0,p)=>{const m=iA(f),g=m?f:c(f),x=p!==void 0;return g?(p||t.getState().nodes).filter(y=>{const w=t.getState().nodeLookup.get(y.id);if(w&&!m&&(y.id===f.id||!w.internals.positionAbsolute))return!1;const b=Xc(x?y:w),_=Of(b,g);return h&&_>0||_>=b.width*b.height||_>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=iA(f)?f:c(f);if(!g)return!1;const x=Of(g,h);return p&&x>0||x>=h.width*h.height||x>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Boe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??Koe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return E.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const RA=e=>e.selected,Lce=typeof window<"u"?window:void 0;function Mce({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=xn(),{deleteElements:r}=S0(),s=Mf(e,{actInsideInputWithModifier:!1}),i=Mf(t,{target:Lce});E.useEffect(()=>{if(s){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(RA),edges:a.filter(RA)}),n.setState({nodesSelectionActive:!1})}},[s]),E.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function jce(e){const t=xn();E.useEffect(()=>{const n=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=n_(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",hi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const T0={position:"absolute",width:"100%",height:"100%",top:0,left:0},Dce=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Pce({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=qo.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:g,noPanClassName:x,onViewportChange:y,isControlledViewport:w,paneClickDistance:b,selectionOnDrag:_}){const k=xn(),N=E.useRef(null),{userSelectionActive:A,lib:S,connectionInProgress:C}=Ot(Dce,bn),R=Mf(h),O=E.useRef();jce(N);const F=E.useCallback(q=>{y==null||y({x:q[0],y:q[1],zoom:q[2]}),w||k.setState({transform:q})},[y,w]);return E.useEffect(()=>{if(N.current){O.current=Ale({domNode:N.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:T=>k.setState(M=>M.paneDragging===T?M:{paneDragging:T}),onPanZoomStart:(T,M)=>{const{onViewportChangeStart:j,onMoveStart:U}=k.getState();U==null||U(T,M),j==null||j(M)},onPanZoom:(T,M)=>{const{onViewportChange:j,onMove:U}=k.getState();U==null||U(T,M),j==null||j(M)},onPanZoomEnd:(T,M)=>{const{onViewportChangeEnd:j,onMoveEnd:U}=k.getState();U==null||U(T,M),j==null||j(M)}});const{x:q,y:L,zoom:D}=O.current.getViewport();return k.setState({panZoom:O.current,transform:[q,L,D],domNode:N.current.closest(".react-flow")}),()=>{var T;(T=O.current)==null||T.destroy()}}},[]),E.useEffect(()=>{var q;(q=O.current)==null||q.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:R,preventScrolling:p,noPanClassName:x,userSelectionActive:A,noWheelClassName:g,lib:S,onTransformChange:F,connectionInProgress:C,selectionOnDrag:_,paneClickDistance:b})},[e,t,n,r,s,i,a,o,R,p,x,A,g,S,F,C,_,b]),l.jsx("div",{className:"react-flow__renderer",ref:N,style:T0,children:m})}const Bce=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Fce(){const{userSelectionActive:e,userSelectionRect:t}=Ot(Bce,bn);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const bb=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Uce=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function $ce({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Rf.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:g}){const x=E.useRef(0),y=xn(),{userSelectionActive:w,elementsSelectable:b,dragging:_,connectionInProgress:k,panBy:N,autoPanSpeed:A}=Ot(Uce,bn),S=b&&(e||w),C=E.useRef(null),R=E.useRef(),O=E.useRef(new Set),F=E.useRef(new Set),q=E.useRef(!1),L=E.useRef({x:0,y:0}),D=E.useRef(!1),T=J=>{if(q.current||k){q.current=!1;return}u==null||u(J),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=J=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){J.preventDefault();return}d==null||d(J)},j=f?J=>f(J):void 0,U=J=>{q.current&&(J.stopPropagation(),q.current=!1)},I=J=>{var We,Ce;const{domNode:fe,transform:te}=y.getState();if(R.current=fe==null?void 0:fe.getBoundingClientRect(),!R.current)return;const ge=J.target===C.current;if(!ge&&!!J.target.closest(".nokey")||!e||!(a&&ge||t)||J.button!==0||!J.isPrimary)return;(Ce=(We=J.target)==null?void 0:We.setPointerCapture)==null||Ce.call(We,J.pointerId),q.current=!1;const{x:me,y:Ne}=ai(J.nativeEvent,R.current),Ie=mu({x:me,y:Ne},te);y.setState({userSelectionRect:{width:0,height:0,startX:Ie.x,startY:Ie.y,x:me,y:Ne}}),ge||(J.stopPropagation(),J.preventDefault())};function K(J,fe){const{userSelectionRect:te}=y.getState();if(!te)return;const{transform:ge,nodeLookup:we,edgeLookup:Z,connectionLookup:me,triggerNodeChanges:Ne,triggerEdgeChanges:Ie,defaultEdgeOptions:We}=y.getState(),Ce={x:te.startX,y:te.startY},{x:et,y:Ge}=Qc(Ce,ge),Xe={startX:Ce.x,startY:Ce.y,x:Jut.id)),F.current=new Set;const At=(We==null?void 0:We.selectable)??!0;for(const ut of O.current){const X=me.get(ut);if(X)for(const{edgeId:ne}of X.values()){const he=Z.get(ne);he&&(he.selectable??At)&&F.current.add(ne)}}if(!aA(xt,O.current)){const ut=sc(we,O.current,!0);Ne(ut)}if(!aA(gt,F.current)){const ut=sc(Z,F.current);Ie(ut)}y.setState({userSelectionRect:Xe,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!R.current)return;const[J,fe]=Jv(L.current,R.current,A);N({x:J,y:fe}).then(te=>{if(!q.current||!te){x.current=requestAnimationFrame(W);return}const{x:ge,y:we}=L.current;K(ge,we),x.current=requestAnimationFrame(W)})}const B=()=>{cancelAnimationFrame(x.current),x.current=0,D.current=!1};E.useEffect(()=>()=>B(),[]);const ie=J=>{const{userSelectionRect:fe,transform:te,resetSelectedElements:ge}=y.getState();if(!R.current||!fe)return;const{x:we,y:Z}=ai(J.nativeEvent,R.current);L.current={x:we,y:Z};const me=Qc({x:fe.startX,y:fe.startY},te);if(!q.current){const Ne=t?0:i;if(Math.hypot(we-me.x,Z-me.y)<=Ne)return;ge(),o==null||o(J)}q.current=!0,D.current||(W(),D.current=!0),K(we,Z)},Q=J=>{var fe,te;J.button===0&&((te=(fe=J.target)==null?void 0:fe.releasePointerCapture)==null||te.call(fe,J.pointerId),!w&&J.target===C.current&&y.getState().userSelectionRect&&(T==null||T(J)),y.setState({userSelectionActive:!1,userSelectionRect:null}),q.current&&(c==null||c(J),y.setState({nodesSelectionActive:O.current.size>0})),B())},ee=J=>{var fe,te;(te=(fe=J.target)==null?void 0:fe.releasePointerCapture)==null||te.call(fe,J.pointerId),B()},ce=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:zn(["react-flow__pane",{draggable:ce,dragging:_,selection:e}]),onClick:S?void 0:bb(T,C),onContextMenu:bb(M,C),onWheel:bb(j,C),onPointerEnter:S?void 0:h,onPointerMove:S?ie:p,onPointerUp:S?Q:void 0,onPointerCancel:S?ee:void 0,onPointerDownCapture:S?I:void 0,onClickCapture:S?U:void 0,onPointerLeave:m,ref:C,style:T0,children:[g,l.jsx(Fce,{})]})}function ex({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",hi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function a4({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=xn(),[c,u]=E.useState(!1),d=E.useRef();return E.useEffect(()=>{d.current=ple({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{ex({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),E.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const Hce=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function o4(){const e=xn();return E.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Hce(a),p=s?i[0]:5,m=s?i[1]:5,g=n.direction.x*p*n.factor,x=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let w={x:y.internals.positionAbsolute.x+g,y:y.internals.positionAbsolute.y+x};s&&(w=ch(w,i));const{position:b,positionAbsolute:_}=vP({nodeId:y.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});y.position=b,y.internals.positionAbsolute=_,f.set(y.id,y)}c(f)},[])}const l_=E.createContext(null),zce=l_.Provider;l_.Consumer;const l4=()=>E.useContext(l_),Vce=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Kce=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Gc.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:d&&u}};function Yce({type:e="source",position:t=Ue.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var D,T;const m=a||null,g=e==="target",x=xn(),y=l4(),{connectOnClick:w,noPanClassName:b,rfId:_}=Ot(Vce,bn),{connectingFrom:k,connectingTo:N,clickConnecting:A,isPossibleEndHandle:S,connectionInProcess:C,clickConnectionInProcess:R,valid:O}=Ot(Kce(y,m,e),bn);y||(T=(D=x.getState()).onError)==null||T.call(D,"010",hi.error010());const F=M=>{const{defaultEdgeOptions:j,onConnect:U,hasDefaultEdges:I}=x.getState(),K={...j,...M};if(I){const{edges:W,setEdges:B,onError:ie}=x.getState();B(r4(K,W,{onError:ie}))}U==null||U(K),o==null||o(K)},q=M=>{if(!y)return;const j=CP(M.nativeEvent);if(s&&(j&&M.button===0||!j)){const U=x.getState();JE.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:g,handleId:m,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...I)=>{var K,W;return(W=(K=x.getState()).onConnectEnd)==null?void 0:W.call(K,...I)},updateConnection:U.updateConnection,onConnect:F,isValidConnection:n||((...I)=>{var K,W;return((W=(K=x.getState()).isValidConnection)==null?void 0:W.call(K,...I))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}j?d==null||d(M):f==null||f(M)},L=M=>{const{onClickConnectStart:j,onClickConnectEnd:U,connectionClickStartHandle:I,connectionMode:K,isValidConnection:W,lib:B,rfId:ie,nodeLookup:Q,connection:ee}=x.getState();if(!y||!I&&!s)return;if(!I){j==null||j(M.nativeEvent,{nodeId:y,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const ce=TP(M.target),J=n||W,{connection:fe,isValid:te}=JE.isValid(M.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:K,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:J,flowId:ie,doc:ce,lib:B,nodeLookup:Q});te&&fe&&F(fe);const ge=structuredClone(ee);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,U==null||U(M,ge),x.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${_}-${y}-${m}-${e}`,className:zn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!g,target:g,connectable:r,connectablestart:s,connectableend:i,clickconnecting:A,connectingfrom:k,connectingto:N,valid:O,connectionindicator:r&&(!C||S)&&(C||R?i:s)}]),onMouseDown:q,onTouchStart:q,onClick:w?L:void 0,ref:p,...h,children:c})}const kr=E.memo(s4(Yce));function Gce({data:e,isConnectable:t,sourcePosition:n=Ue.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(kr,{type:"source",position:n,isConnectable:t})]})}function Wce({data:e,isConnectable:t,targetPosition:n=Ue.Top,sourcePosition:r=Ue.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(kr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(kr,{type:"source",position:r,isConnectable:t})]})}function qce(){return null}function Xce({data:e,isConnectable:t,targetPosition:n=Ue.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(kr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const fg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},OA={input:Gce,default:Wce,output:Xce,group:qce};function Qce(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Zce=e=>{const{width:t,height:n,x:r,y:s}=lh(e.nodeLookup,{filter:i=>!!i.selected});return{width:ii(t)?t:null,height:ii(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function Jce({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xn(),{width:s,height:i,transformString:a,userSelectionActive:o}=Ot(Zce,bn),c=o4(),u=E.useRef(null);E.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&s!==null&&i!==null;if(a4({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(g=>g.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(fg,p.key)&&(p.preventDefault(),c({direction:fg[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:zn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const LA=typeof window<"u"?window:void 0,eue=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function c4({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:g,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:A,panOnDrag:S,autoPanOnSelection:C,defaultViewport:R,translateExtent:O,minZoom:F,maxZoom:q,preventScrolling:L,onSelectionContextMenu:D,noWheelClassName:T,noPanClassName:M,disableKeyboardA11y:j,onViewportChange:U,isControlledViewport:I}){const{nodesSelectionActive:K,userSelectionActive:W}=Ot(eue,bn),B=Mf(u,{target:LA}),ie=Mf(g,{target:LA}),Q=ie||S,ee=ie||_,ce=d&&Q!==!0,J=B||W||ce;return Mce({deleteKeyCode:c,multiSelectionKeyCode:m}),l.jsx(Pce,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:ee,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:A,panOnDrag:!B&&Q,defaultViewport:R,translateExtent:O,minZoom:F,maxZoom:q,zoomActivationKeyCode:x,preventScrolling:L,noWheelClassName:T,noPanClassName:M,onViewportChange:U,isControlledViewport:I,paneClickDistance:o,selectionOnDrag:ce,children:l.jsxs($ce,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:Q,autoPanOnSelection:C,isSelecting:!!J,selectionMode:f,selectionKeyPressed:B,paneClickDistance:o,selectionOnDrag:ce,children:[e,K&&l.jsx(Jce,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:j})]})})}c4.displayName="FlowRenderer";const tue=E.memo(c4),nue=e=>t=>e?Zv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function rue(e){return Ot(E.useCallback(nue(e),[e]),bn)}const sue=e=>e.updateNodeInternals;function iue(){const e=Ot(sue),[t]=E.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return E.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function aue({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=xn(),i=E.useRef(null),a=E.useRef(null),o=E.useRef(e.sourcePosition),c=E.useRef(e.targetPosition),u=E.useRef(t),d=n&&!!e.internals.handleBounds;return E.useEffect(()=>{i.current&&!e.hidden&&(!d||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[d,e.hidden]),E.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),E.useEffect(()=>{if(i.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function oue({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:g,nodeTypes:x,nodeClickDistance:y,onError:w}){const{node:b,internals:_,isParent:k}=Ot(J=>{const fe=J.nodeLookup.get(e),te=J.parentLookup.has(e);return{node:fe,internals:fe.internals,isParent:te}},bn);let N=b.type||"default",A=(x==null?void 0:x[N])||OA[N];A===void 0&&(w==null||w("003",hi.error003(N)),N="default",A=(x==null?void 0:x.default)||OA.default);const S=!!(b.draggable||o&&typeof b.draggable>"u"),C=!!(b.selectable||c&&typeof b.selectable>"u"),R=!!(b.connectable||u&&typeof b.connectable>"u"),O=!!(b.focusable||d&&typeof b.focusable>"u"),F=xn(),q=t_(b),L=aue({node:b,nodeType:N,hasDimensions:q,resizeObserver:f}),D=a4({nodeRef:L,disabled:b.hidden||!S,noDragClassName:h,handleSelector:b.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),T=o4();if(b.hidden)return null;const M=ba(b),j=Qce(b),U=C||S||t||n||r||s,I=n?J=>n(J,{..._.userNode}):void 0,K=r?J=>r(J,{..._.userNode}):void 0,W=s?J=>s(J,{..._.userNode}):void 0,B=i?J=>i(J,{..._.userNode}):void 0,ie=a?J=>a(J,{..._.userNode}):void 0,Q=J=>{const{selectNodesOnDrag:fe,nodeDragThreshold:te}=F.getState();C&&(!fe||!S||te>0)&&ex({id:e,store:F,nodeRef:L}),t&&t(J,{..._.userNode})},ee=J=>{if(!(AP(J.nativeEvent)||m)){if(yP.includes(J.key)&&C){const fe=J.key==="Escape";ex({id:e,store:F,unselect:fe,nodeRef:L})}else if(S&&b.selected&&Object.prototype.hasOwnProperty.call(fg,J.key)){J.preventDefault();const{ariaLabelConfig:fe}=F.getState();F.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:J.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),T({direction:fg[J.key],factor:J.shiftKey?4:1})}}},ce=()=>{var me;if(m||!((me=L.current)!=null&&me.matches(":focus-visible")))return;const{transform:J,width:fe,height:te,autoPanOnNodeFocus:ge,setCenter:we}=F.getState();if(!ge)return;Zv(new Map([[e,b]]),{x:0,y:0,width:fe,height:te},J,!0).length>0||we(b.position.x+M.width/2,b.position.y+M.height/2,{zoom:J[2]})};return l.jsx("div",{className:zn(["react-flow__node",`react-flow__node-${N}`,{[p]:S},b.className,{selected:b.selected,selectable:C,parent:k,draggable:S,dragging:D}]),ref:L,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:q?"visible":"hidden",...b.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:K,onMouseLeave:W,onContextMenu:B,onClick:Q,onDoubleClick:ie,onKeyDown:O?ee:void 0,tabIndex:O?0:void 0,onFocus:O?ce:void 0,role:b.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${QP}-${g}`,"aria-label":b.ariaLabel,...b.domAttributes,children:l.jsx(zce,{value:e,children:l.jsx(A,{id:e,data:b.data,type:N,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:b.selected??!1,selectable:C,draggable:S,deletable:b.deletable??!0,isConnectable:R,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:D,dragHandle:b.dragHandle,zIndex:_.z,parentId:b.parentId,...M})})})}var lue=E.memo(oue);const cue=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function u4(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Ot(cue,bn),a=rue(e.onlyRenderVisibleElements),o=iue();return l.jsx("div",{className:"react-flow__nodes",style:T0,children:a.map(c=>l.jsx(lue,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}u4.displayName="NodeRenderer";const uue=E.memo(u4);function due(e){return Ot(E.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&qoe({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bn)}const fue=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},hue=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},MA={[Wc.Arrow]:fue,[Wc.ArrowClosed]:hue};function pue(e){const t=xn();return E.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(MA,e)?MA[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",hi.error009(e)),null)},[e])}const mue=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=pue(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},d4=({defaultColor:e,rfId:t})=>{const n=Ot(i=>i.edges),r=Ot(i=>i.defaultEdgeOptions),s=E.useMemo(()=>rle(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:s.map(i=>l.jsx(mue,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};d4.displayName="MarkerDefinitions";var gue=E.memo(d4);function f4({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=E.useState({x:1,y:0,width:0,height:0}),p=zn(["react-flow__edge-textwrapper",u]),m=E.useRef(null);return E.useEffect(()=>{if(m.current){const g=m.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),c]}):null}f4.displayName="EdgeText";const yue=E.memo(f4);function uh({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:zn(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&ii(t)&&ii(n)?l.jsx(yue,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function jA({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ue.Left||e===Ue.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function h4({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:i=Ue.Top}){const[a,o]=jA({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=jA({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=IP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${r},${s}`,d,f,h,p]}function p4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:y})=>{const[w,b,_]=h4({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),k=e.isInternal?void 0:t;return l.jsx(uh,{id:k,path:w,labelX:b,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:y})})}const bue=p4({isInternal:!1}),m4=p4({isInternal:!0});bue.displayName="SimpleBezierEdge";m4.displayName="SimpleBezierEdgeInternal";function g4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Ue.Bottom,targetPosition:m=Ue.Top,markerEnd:g,markerStart:x,pathOptions:y,interactionWidth:w})=>{const[b,_,k]=dg({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),N=e.isInternal?void 0:t;return l.jsx(uh,{id:N,path:b,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:w})})}const y4=g4({isInternal:!1}),b4=g4({isInternal:!0});y4.displayName="SmoothStepEdge";b4.displayName="SmoothStepEdgeInternal";function E4(e){return E.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return l.jsx(y4,{...n,id:r,pathOptions:E.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Eue=E4({isInternal:!1}),x4=E4({isInternal:!0});Eue.displayName="StepEdge";x4.displayName="StepEdgeInternal";function w4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})=>{const[x,y,w]=LP({sourceX:n,sourceY:r,targetX:s,targetY:i}),b=e.isInternal?void 0:t;return l.jsx(uh,{id:b,path:x,labelX:y,labelY:w,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})})}const xue=w4({isInternal:!1}),v4=w4({isInternal:!0});xue.displayName="StraightEdge";v4.displayName="StraightEdgeInternal";function _4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ue.Bottom,targetPosition:o=Ue.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,pathOptions:y,interactionWidth:w})=>{const[b,_,k]=RP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:y==null?void 0:y.curvature}),N=e.isInternal?void 0:t;return l.jsx(uh,{id:N,path:b,labelX:_,labelY:k,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:w})})}const wue=_4({isInternal:!1}),k4=_4({isInternal:!0});wue.displayName="BezierEdge";k4.displayName="BezierEdgeInternal";const DA={default:k4,straight:v4,step:x4,smoothstep:b4,simplebezier:m4},PA={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},vue=(e,t,n)=>n===Ue.Left?e-t:n===Ue.Right?e+t:e,_ue=(e,t,n)=>n===Ue.Top?e-t:n===Ue.Bottom?e+t:e,BA="react-flow__edgeupdater";function FA({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:zn([BA,`${BA}-${o}`]),cx:vue(t,r,e),cy:_ue(n,r,e),r,stroke:"transparent",fill:"transparent"})}function kue({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=xn(),g=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:N,domNode:A,connectionMode:S,connectionRadius:C,lib:R,onConnectStart:O,cancelConnection:F,nodeLookup:q,rfId:L,panBy:D,updateConnection:T}=m.getState(),M=k.type==="target",j=(K,W)=>{h(!1),f==null||f(K,n,k.type,W)},U=K=>u==null?void 0:u(n,K),I=(K,W)=>{h(!0),d==null||d(_,n,k.type),O==null||O(K,W)};JE.onPointerDown(_.nativeEvent,{autoPanOnConnect:N,connectionMode:S,connectionRadius:C,domNode:A,handleId:k.id,nodeId:k.nodeId,nodeLookup:q,isTarget:M,edgeUpdaterType:k.type,lib:R,flowId:L,cancelConnection:F,panBy:D,isValidConnection:(...K)=>{var W,B;return((B=(W=m.getState()).isValidConnection)==null?void 0:B.call(W,...K))??!0},onConnect:U,onConnectStart:I,onConnectEnd:(...K)=>{var W,B;return(B=(W=m.getState()).onConnectEnd)==null?void 0:B.call(W,...K)},onReconnectEnd:j,updateConnection:T,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},x=_=>g(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=_=>g(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),w=()=>p(!0),b=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(FA,{position:o,centerX:r,centerY:s,radius:t,onMouseDown:x,onMouseEnter:w,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&l.jsx(FA,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:w,onMouseOut:b,type:"target"})]})}function Nue({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:g,noPanClassName:x,onError:y,disableKeyboardA11y:w}){let b=Ot(we=>we.edgeLookup.get(e));const _=Ot(we=>we.defaultEdgeOptions);b=_?{..._,...b}:b;let k=b.type||"default",N=(g==null?void 0:g[k])||DA[k];N===void 0&&(y==null||y("011",hi.error011(k)),k="default",N=(g==null?void 0:g.default)||DA.default);const A=!!(b.focusable||t&&typeof b.focusable>"u"),S=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),C=!!(b.selectable||r&&typeof b.selectable>"u"),R=E.useRef(null),[O,F]=E.useState(!1),[q,L]=E.useState(!1),D=xn(),{zIndex:T,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W}=Ot(E.useCallback(we=>{const Z=we.nodeLookup.get(b.source),me=we.nodeLookup.get(b.target);if(!Z||!me)return{zIndex:b.zIndex,...PA};const Ne=nle({id:e,sourceNode:Z,targetNode:me,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:we.connectionMode,onError:y});return{zIndex:Woe({selected:b.selected,zIndex:b.zIndex,sourceNode:Z,targetNode:me,elevateOnSelect:we.elevateEdgesOnSelect,zIndexMode:we.zIndexMode}),...Ne||PA}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),bn),B=E.useMemo(()=>b.markerStart?`url('#${QE(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ie=E.useMemo(()=>b.markerEnd?`url('#${QE(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||M===null||j===null||U===null||I===null)return null;const Q=we=>{var Ie;const{addSelectedEdges:Z,unselectNodesAndEdges:me,multiSelectionActive:Ne}=D.getState();C&&(D.setState({nodesSelectionActive:!1}),b.selected&&Ne?(me({nodes:[],edges:[b]}),(Ie=R.current)==null||Ie.blur()):Z([e])),s&&s(we,b)},ee=i?we=>{i(we,{...b})}:void 0,ce=a?we=>{a(we,{...b})}:void 0,J=o?we=>{o(we,{...b})}:void 0,fe=c?we=>{c(we,{...b})}:void 0,te=u?we=>{u(we,{...b})}:void 0,ge=we=>{var Z;if(!w&&yP.includes(we.key)&&C){const{unselectNodesAndEdges:me,addSelectedEdges:Ne}=D.getState();we.key==="Escape"?((Z=R.current)==null||Z.blur(),me({edges:[b]})):Ne([e])}};return l.jsx("svg",{style:{zIndex:T},children:l.jsxs("g",{className:zn(["react-flow__edge",`react-flow__edge-${k}`,b.className,x,{selected:b.selected,animated:b.animated,inactive:!C&&!s,updating:O,selectable:C}]),onClick:Q,onDoubleClick:ee,onContextMenu:ce,onMouseEnter:J,onMouseMove:fe,onMouseLeave:te,onKeyDown:A?ge:void 0,tabIndex:A?0:void 0,role:b.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":A?`${ZP}-${m}`:void 0,ref:R,...b.domAttributes,children:[!q&&l.jsx(N,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:C,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:B,markerEnd:ie,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),S&&l.jsx(kue,{edge:b,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W,setUpdateHover:F,setReconnecting:L})]})})}var Sue=E.memo(Nue);const Tue=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function N4({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:g}){const{edgesFocusable:x,edgesReconnectable:y,elementsSelectable:w,onError:b}=Ot(Tue,bn),_=due(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(gue,{defaultColor:e,rfId:n}),_.map(k=>l.jsx(Sue,{id:k,edgesFocusable:x,edgesReconnectable:y,elementsSelectable:w,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:g},k))]})}N4.displayName="EdgeRenderer";const Aue=E.memo(N4),Cue=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Iue({children:e}){const t=Ot(Cue);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Rue(e){const t=S0(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Oue=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Lue(e){const t=Ot(Oue),n=xn();return E.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Mue(e){return e.connection.inProgress?{...e.connection,to:mu(e.connection.to,e.transform)}:{...e.connection}}function jue(e){return Mue}function Due(e){const t=jue();return Ot(t,bn)}const Pue=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Bue({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:c}=Ot(Pue,bn);return!(i&&s&&c)?null:l.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:zn(["react-flow__connection",xP(o)]),children:l.jsx(S4,{style:t,type:n,CustomComponent:r,isValid:o})})})}const S4=({style:e,type:t=Ua.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Due();if(!s)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:xP(r),toNode:d,toHandle:f,pointer:p});let m="";const g={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Ua.Bezier:[m]=RP(g);break;case Ua.SimpleBezier:[m]=h4(g);break;case Ua.Step:[m]=dg({...g,borderRadius:0});break;case Ua.SmoothStep:[m]=dg(g);break;default:[m]=LP(g)}return l.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};S4.displayName="ConnectionLine";const Fue={};function UA(e=Fue){E.useRef(e),xn(),E.useEffect(()=>{},[e])}function Uue(){xn(),E.useRef(!1),E.useEffect(()=>{},[])}function T4({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:g,connectionLineComponent:x,connectionLineContainerStyle:y,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:A,deleteKeyCode:S,onlyRenderVisibleElements:C,elementsSelectable:R,defaultViewport:O,translateExtent:F,minZoom:q,maxZoom:L,preventScrolling:D,defaultMarkerColor:T,zoomOnScroll:M,zoomOnPinch:j,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:K,zoomOnDoubleClick:W,panOnDrag:B,autoPanOnSelection:ie,onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ce,onPaneMouseLeave:J,onPaneScroll:fe,onPaneContextMenu:te,paneClickDistance:ge,nodeClickDistance:we,onEdgeContextMenu:Z,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:Ie,reconnectRadius:We,onReconnect:Ce,onReconnectStart:et,onReconnectEnd:Ge,noDragClassName:Xe,noWheelClassName:xt,noPanClassName:gt,disableKeyboardA11y:At,nodeExtent:ut,rfId:X,viewport:ne,onViewportChange:he}){return UA(e),UA(t),Uue(),Rue(n),Lue(ne),l.jsx(tue,{onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ce,onPaneMouseLeave:J,onPaneContextMenu:te,onPaneScroll:fe,paneClickDistance:ge,deleteKeyCode:S,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:A,elementsSelectable:R,zoomOnScroll:M,zoomOnPinch:j,zoomOnDoubleClick:W,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:K,panOnDrag:B,autoPanOnSelection:ie,defaultViewport:O,translateExtent:F,minZoom:q,maxZoom:L,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:Xe,noWheelClassName:xt,noPanClassName:gt,disableKeyboardA11y:At,onViewportChange:he,isControlledViewport:!!ne,children:l.jsxs(Iue,{children:[l.jsx(Aue,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ce,onReconnectStart:et,onReconnectEnd:Ge,onlyRenderVisibleElements:C,onEdgeContextMenu:Z,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:Ie,reconnectRadius:We,defaultMarkerColor:T,noPanClassName:gt,disableKeyboardA11y:At,rfId:X}),l.jsx(Bue,{style:g,type:m,component:x,containerStyle:y}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(uue,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:we,onlyRenderVisibleElements:C,noPanClassName:gt,noDragClassName:Xe,disableKeyboardA11y:At,nodeExtent:ut,rfId:X}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}T4.displayName="GraphView";const $ue=E.memo(T4),Hue=NP(),$A=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,g=new Map,x=new Map,y=r??t??[],w=n??e??[],b=d??[0,0],_=f??If;DP(g,x,y);const{nodesInitialized:k}=ZE(w,p,m,{nodeOrigin:b,nodeExtent:_,zIndexMode:h});let N=[0,0,1];if(a&&s&&i){const A=lh(p,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:S,y:C,zoom:R}=e_(A,s,i,c,u,(o==null?void 0:o.padding)??.1);N=[S,C,R]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:w,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:x,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:If,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Gc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...EP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Hue,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bP,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},zue=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>ice((p,m)=>{async function g(){const{nodeLookup:x,panZoom:y,fitViewOptions:w,fitViewResolver:b,width:_,height:k,minZoom:N,maxZoom:A}=m();y&&(await $oe({nodes:x,width:_,height:k,panZoom:y,minZoom:N,maxZoom:A},w),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...$A({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:x=>{const{nodeLookup:y,parentLookup:w,nodeOrigin:b,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:N,nodesSelectionActive:A}=m(),{nodesInitialized:S,hasSelectedNodes:C}=ZE(x,y,w,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:N}),R=A&&C;k&&S?(g(),p({nodes:x,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:R})):p({nodes:x,nodesInitialized:S,nodesSelectionActive:R})},setEdges:x=>{const{connectionLookup:y,edgeLookup:w}=m();DP(y,w,x),p({edges:x})},setDefaultNodesAndEdges:(x,y)=>{if(x){const{setNodes:w}=m();w(x),p({hasDefaultNodes:!0})}if(y){const{setEdges:w}=m();w(y),p({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:y,nodeLookup:w,parentLookup:b,domNode:_,nodeOrigin:k,nodeExtent:N,debug:A,fitViewQueued:S,zIndexMode:C}=m(),{changes:R,updatedInternals:O}=ule(x,w,b,_,k,N,C);O&&(ale(w,b,{nodeOrigin:k,nodeExtent:N,zIndexMode:C}),S?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(R==null?void 0:R.length)>0&&(A&&console.log("React Flow: trigger node changes",R),y==null||y(R)))},updateNodePositions:(x,y=!1)=>{const w=[];let b=[];const{nodeLookup:_,triggerNodeChanges:k,connection:N,updateConnection:A,onNodesChangeMiddlewareMap:S}=m();for(const[C,R]of x){const O=_.get(C),F=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(R!=null&&R.position)),q={id:C,type:"position",position:F?{x:Math.max(0,R.position.x),y:Math.max(0,R.position.y)}:R.position,dragging:y};if(O&&N.inProgress&&N.fromNode.id===O.id){const L=cl(O,N.fromHandle,Ue.Left,!0);A({...N,from:L})}F&&O.parentId&&w.push({id:C,parentId:O.parentId,rect:{...R.internals.positionAbsolute,width:R.measured.width??0,height:R.measured.height??0}}),b.push(q)}if(w.length>0){const{parentLookup:C,nodeOrigin:R}=m(),O=o_(w,_,C,R);b.push(...O)}for(const C of S.values())b=C(b);k(b)},triggerNodeChanges:x=>{const{onNodesChange:y,setNodes:w,nodes:b,hasDefaultNodes:_,debug:k}=m();if(x!=null&&x.length){if(_){const N=t4(x,b);w(N)}k&&console.log("React Flow: trigger node changes",x),y==null||y(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:y,setEdges:w,edges:b,hasDefaultEdges:_,debug:k}=m();if(x!=null&&x.length){if(_){const N=n4(x,b);w(N)}k&&console.log("React Flow: trigger edge changes",x),y==null||y(x)}},addSelectedNodes:x=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(y){const N=x.map(A=>Ao(A,!0));_(N);return}_(sc(b,new Set([...x]),!0)),k(sc(w))},addSelectedEdges:x=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(y){const N=x.map(A=>Ao(A,!0));k(N);return}k(sc(w,new Set([...x]))),_(sc(b,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:y}={})=>{const{edges:w,nodes:b,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:N}=m(),A=x||b,S=y||w,C=[];for(const O of A){if(!O.selected)continue;const F=_.get(O.id);F&&(F.selected=!1),C.push(Ao(O.id,!1))}const R=[];for(const O of S)O.selected&&R.push(Ao(O.id,!1));k(C),N(R)},setMinZoom:x=>{const{panZoom:y,maxZoom:w}=m();y==null||y.setScaleExtent([x,w]),p({minZoom:x})},setMaxZoom:x=>{const{panZoom:y,minZoom:w}=m();y==null||y.setScaleExtent([w,x]),p({maxZoom:x})},setTranslateExtent:x=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(x),p({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:y,triggerNodeChanges:w,triggerEdgeChanges:b,elementsSelectable:_}=m();if(!_)return;const k=y.reduce((A,S)=>S.selected?[...A,Ao(S.id,!1)]:A,[]),N=x.reduce((A,S)=>S.selected?[...A,Ao(S.id,!1)]:A,[]);w(k),b(N)},setNodeExtent:x=>{const{nodes:y,nodeLookup:w,parentLookup:b,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:N,zIndexMode:A}=m();x[0][0]===N[0][0]&&x[0][1]===N[0][1]&&x[1][0]===N[1][0]&&x[1][1]===N[1][1]||(ZE(y,w,b,{nodeOrigin:_,nodeExtent:x,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:A}),p({nodeExtent:x}))},panBy:x=>{const{transform:y,width:w,height:b,panZoom:_,translateExtent:k}=m();return dle({delta:x,panZoom:_,transform:y,translateExtent:k,width:w,height:b})},setCenter:async(x,y,w)=>{const{width:b,height:_,maxZoom:k,panZoom:N}=m();if(!N)return!1;const A=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:k;return await N.setViewport({x:b/2-x*A,y:_/2-y*A,zoom:A},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),!0},cancelConnection:()=>{p({connection:{...EP}})},updateConnection:x=>{p({connection:x})},reset:()=>p({...$A()})}},Object.is);function c_({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=E.useState(()=>zue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(ace,{value:m,children:l.jsx(Ice,{children:p})})}function Vue({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return E.useContext(k0)?l.jsx(l.Fragment,{children:e}):l.jsx(c_,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Kue={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Yue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:y,onNodeMouseEnter:w,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:A,onNodeDrag:S,onNodeDragStop:C,onNodesDelete:R,onEdgesDelete:O,onDelete:F,onSelectionChange:q,onSelectionDragStart:L,onSelectionDrag:D,onSelectionDragStop:T,onSelectionContextMenu:M,onSelectionStart:j,onSelectionEnd:U,onBeforeDelete:I,connectionMode:K,connectionLineType:W=Ua.Bezier,connectionLineStyle:B,connectionLineComponent:ie,connectionLineContainerStyle:Q,deleteKeyCode:ee="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:J=!1,selectionMode:fe=Rf.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ge=Lf()?"Meta":"Control",zoomActivationKeyCode:we=Lf()?"Meta":"Control",snapToGrid:Z,snapGrid:me,onlyRenderVisibleElements:Ne=!1,selectNodesOnDrag:Ie,nodesDraggable:We,autoPanOnNodeFocus:Ce,nodesConnectable:et,nodesFocusable:Ge,nodeOrigin:Xe=JP,edgesFocusable:xt,edgesReconnectable:gt,elementsSelectable:At=!0,defaultViewport:ut=Ece,minZoom:X=.5,maxZoom:ne=2,translateExtent:he=If,preventScrolling:Te=!0,nodeExtent:He,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:Ut=!0,zoomOnPinch:Ye=!0,panOnScroll:De=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:Ct=qo.Free,zoomOnDoubleClick:un=!0,panOnDrag:$t=!0,onPaneClick:wn,onPaneMouseEnter:Fe,onPaneMouseMove:dt,onPaneMouseLeave:Lt,onPaneScroll:_t,onPaneContextMenu:be,paneClickDistance:Ve=1,nodeClickDistance:st=0,children:sn,onReconnect:an,onReconnectStart:Ht,onReconnectEnd:zt,onEdgeContextMenu:Bt,onEdgeDoubleClick:qt,onEdgeMouseEnter:vn,onEdgeMouseMove:Xt,onEdgeMouseLeave:Ln,reconnectRadius:Mn=10,onNodesChange:ue,onEdgesChange:_e,noDragClassName:ve="nodrag",noWheelClassName:ye="nowheel",noPanClassName:nt="nopan",fitView:Qe,fitViewOptions:ct,connectOnClick:ot,attributionPosition:oe,proOptions:Ze,defaultEdgeOptions:It,elevateNodesOnSelect:it=!0,elevateEdgesOnSelect:kt=!1,disableKeyboardA11y:Ft=!1,autoPanOnConnect:Zn,autoPanOnNodeDrag:or,autoPanOnSelection:lr=!0,autoPanSpeed:dn,connectionRadius:Zt,isValidConnection:Yt,onError:Jt,style:Mt,id:Cn,nodeDragThreshold:fn,connectionDragThreshold:en,viewport:Vn,onViewportChange:hn,width:gr,height:Kn,colorMode:bs="light",debug:yr,onScroll:es,ariaLabelConfig:Es,zIndexMode:bi="basic",...po},xs){const Ei=Cn||"1",$i=_ce(bs),Ur=E.useCallback(Ar=>{Ar.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),es==null||es(Ar)},[es]);return l.jsx("div",{"data-testid":"rf__wrapper",...po,onScroll:Ur,style:{...Mt,...Kue},ref:xs,className:zn(["react-flow",s,$i]),id:Cn,role:"application",children:l.jsxs(Vue,{nodes:e,edges:t,width:gr,height:Kn,fitView:Qe,fitViewOptions:ct,minZoom:X,maxZoom:ne,nodeOrigin:Xe,nodeExtent:He,zIndexMode:bi,children:[l.jsx(vce,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:y,nodesDraggable:We,autoPanOnNodeFocus:Ce,nodesConnectable:et,nodesFocusable:Ge,edgesFocusable:xt,edgesReconnectable:gt,elementsSelectable:At,elevateNodesOnSelect:it,elevateEdgesOnSelect:kt,minZoom:X,maxZoom:ne,nodeExtent:He,onNodesChange:ue,onEdgesChange:_e,snapToGrid:Z,snapGrid:me,connectionMode:K,translateExtent:he,connectOnClick:ot,defaultEdgeOptions:It,fitView:Qe,fitViewOptions:ct,onNodesDelete:R,onEdgesDelete:O,onDelete:F,onNodeDragStart:A,onNodeDrag:S,onNodeDragStop:C,onSelectionDrag:D,onSelectionDragStart:L,onSelectionDragStop:T,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:nt,nodeOrigin:Xe,rfId:Ei,autoPanOnConnect:Zn,autoPanOnNodeDrag:or,autoPanSpeed:dn,onError:Jt,connectionRadius:Zt,isValidConnection:Yt,selectNodesOnDrag:Ie,nodeDragThreshold:fn,connectionDragThreshold:en,onBeforeDelete:I,debug:yr,ariaLabelConfig:Es,zIndexMode:bi}),l.jsx($ue,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:W,connectionLineStyle:B,connectionLineComponent:ie,connectionLineContainerStyle:Q,selectionKeyCode:ce,selectionOnDrag:J,selectionMode:fe,deleteKeyCode:ee,multiSelectionKeyCode:ge,panActivationKeyCode:te,zoomActivationKeyCode:we,onlyRenderVisibleElements:Ne,defaultViewport:ut,translateExtent:he,minZoom:X,maxZoom:ne,preventScrolling:Te,zoomOnScroll:Ut,zoomOnPinch:Ye,zoomOnDoubleClick:un,panOnScroll:De,panOnScrollSpeed:Be,panOnScrollMode:Ct,panOnDrag:$t,autoPanOnSelection:lr,onPaneClick:wn,onPaneMouseEnter:Fe,onPaneMouseMove:dt,onPaneMouseLeave:Lt,onPaneScroll:_t,onPaneContextMenu:be,paneClickDistance:Ve,nodeClickDistance:st,onSelectionContextMenu:M,onSelectionStart:j,onSelectionEnd:U,onReconnect:an,onReconnectStart:Ht,onReconnectEnd:zt,onEdgeContextMenu:Bt,onEdgeDoubleClick:qt,onEdgeMouseEnter:vn,onEdgeMouseMove:Xt,onEdgeMouseLeave:Ln,reconnectRadius:Mn,defaultMarkerColor:qe,noDragClassName:ve,noWheelClassName:ye,noPanClassName:nt,rfId:Ei,disableKeyboardA11y:Ft,nodeExtent:He,viewport:Vn,onViewportChange:hn}),l.jsx(bce,{onSelectionChange:q}),sn,l.jsx(hce,{proOptions:Ze,position:oe}),l.jsx(fce,{rfId:Ei,disableKeyboardA11y:Ft})]})})}var A4=s4(Yue);const Gue=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Wue({children:e}){const t=Ot(Gue);return t?Us.createPortal(e,t):null}function C4(e){const[t,n]=E.useState(e),r=E.useCallback(s=>n(i=>t4(s,i)),[]);return[t,n,r]}function I4(e){const[t,n]=E.useState(e),r=E.useCallback(s=>n(i=>n4(s,i)),[]);return[t,n,r]}const que=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!t_(n.userNode))return!1;return!0};function Xue(e={includeHiddenNodes:!1}){return Ot(que(e))}function Que({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:zn(["react-flow__background-pattern",n,r])})}function Zue({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:zn(["react-flow__background-pattern","dots",t])})}var eo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(eo||(eo={}));const Jue={[eo.Dots]:1,[eo.Lines]:1,[eo.Cross]:6},ede=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function R4({id:e,variant:t=eo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=E.useRef(null),{transform:h,patternId:p}=Ot(ede,bn),m=r||Jue[t],g=t===eo.Dots,x=t===eo.Cross,y=Array.isArray(n)?n:[n,n],w=[y[0]*h[2]||1,y[1]*h[2]||1],b=m*h[2],_=Array.isArray(i)?i:[i,i],k=x?[b,b]:w,N=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],A=`${p}${e||""}`;return l.jsxs("svg",{className:zn(["react-flow__background",u]),style:{...c,...T0,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:A,x:h[0]%w[0],y:h[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:g?l.jsx(Zue,{radius:b/2,className:d}):l.jsx(Que,{dimensions:k,lineWidth:s,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}R4.displayName="Background";const O4=E.memo(R4);function tde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function rde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function sde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ide(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function wp({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:zn(["react-flow__controls-button",t]),...n,children:e})}const ade=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function L4({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=xn(),{isInteractive:g,minZoomReached:x,maxZoomReached:y,ariaLabelConfig:w}=Ot(ade,bn),{zoomIn:b,zoomOut:_,fitView:k}=S0(),N=()=>{b(),i==null||i()},A=()=>{_(),a==null||a()},S=()=>{k(s),o==null||o()},C=()=>{m.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},R=h==="horizontal"?"horizontal":"vertical";return l.jsxs(N0,{className:zn(["react-flow__controls",R,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??w["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(wp,{onClick:N,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:y,children:l.jsx(tde,{})}),l.jsx(wp,{onClick:A,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:l.jsx(nde,{})})]}),n&&l.jsx(wp,{className:"react-flow__controls-fitview",onClick:S,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:l.jsx(rde,{})}),r&&l.jsx(wp,{className:"react-flow__controls-interactive",onClick:C,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:g?l.jsx(ide,{}):l.jsx(sde,{})}),d]})}L4.displayName="Controls";const M4=E.memo(L4);function ode({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:g}=i||{},x=a||m||g;return l.jsx("rect",{className:zn(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:x,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const lde=E.memo(ode),cde=e=>e.nodes.map(t=>t.id),Eb=e=>e instanceof Function?e:()=>e;function ude({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=lde,onClick:a}){const o=Ot(cde,bn),c=Eb(t),u=Eb(e),d=Eb(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(fde,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},h))})}function dde({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Ot(m=>{const g=m.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const x=g.internals.userNode,{x:y,y:w}=g.internals.positionAbsolute,{width:b,height:_}=ba(x);return{node:x,x:y,y:w,width:b,height:_}},bn);return!u||u.hidden||!t_(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const fde=E.memo(dde);var hde=E.memo(ude);const pde=200,mde=150,gde=e=>!e.hidden,yde=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?kP(lh(e.nodeLookup,{filter:gde}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bde="react-flow__minimap-desc";function j4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:g=!1,zoomable:x=!1,ariaLabel:y,inversePan:w,zoomStep:b=1,offsetScale:_=5}){const k=xn(),N=E.useRef(null),{boundingRect:A,viewBB:S,rfId:C,panZoom:R,translateExtent:O,flowWidth:F,flowHeight:q,ariaLabelConfig:L}=Ot(yde,bn),D=(e==null?void 0:e.width)??pde,T=(e==null?void 0:e.height)??mde,M=A.width/D,j=A.height/T,U=Math.max(M,j),I=U*D,K=U*T,W=_*U,B=A.x-(I-A.width)/2-W,ie=A.y-(K-A.height)/2-W,Q=I+W*2,ee=K+W*2,ce=`${bde}-${C}`,J=E.useRef(0),fe=E.useRef();J.current=U,E.useEffect(()=>{if(N.current&&R)return fe.current=xle({domNode:N.current,panZoom:R,getTransform:()=>k.getState().transform,getViewScale:()=>J.current}),()=>{var Z;(Z=fe.current)==null||Z.destroy()}},[R]),E.useEffect(()=>{var Z;(Z=fe.current)==null||Z.update({translateExtent:O,width:F,height:q,inversePan:w,pannable:g,zoomStep:b,zoomable:x})},[g,x,w,b,O,F,q]);const te=p?Z=>{var Ie;const[me,Ne]=((Ie=fe.current)==null?void 0:Ie.pointer(Z))||[0,0];p(Z,{x:me,y:Ne})}:void 0,ge=m?E.useCallback((Z,me)=>{const Ne=k.getState().nodeLookup.get(me).internals.userNode;m(Z,Ne)},[]):void 0,we=y??L["minimap.ariaLabel"];return l.jsx(N0,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*U:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:zn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:D,height:T,viewBox:`${B} ${ie} ${Q} ${ee}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:N,onClick:te,children:[we&&l.jsx("title",{id:ce,children:we}),l.jsx(hde,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-W},${ie-W}h${Q+W*2}v${ee+W*2}h${-Q-W*2}z - M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}j4.displayName="MiniMap";const Ede=E.memo(j4),xde=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,wde={[Zc.Line]:"right",[Zc.Handle]:"bottom-right"};function vde({nodeId:e,position:t,variant:n=Zc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:g,onResize:x,onResizeEnd:y}){const w=l4(),b=typeof e=="string"?e:w,_=xn(),k=E.useRef(null),N=n===Zc.Handle,A=Ot(E.useCallback(xde(N&&p),[N,p]),bn),S=E.useRef(null),C=t??wde[n];E.useEffect(()=>{if(!(!k.current||!b))return S.current||(S.current=Lle({domNode:k.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:O,transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D,domNode:T}=_.getState();return{nodeLookup:O,transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D,paneDomNode:T}},onChange:(O,F)=>{const{triggerNodeChanges:q,nodeLookup:L,parentLookup:D,nodeOrigin:T}=_.getState(),M=[],j={x:O.x,y:O.y},U=L.get(b);if(U&&U.expandParent&&U.parentId){const I=U.origin??T,K=O.width??U.measured.width??0,W=O.height??U.measured.height??0,B={id:U.id,parentId:U.parentId,rect:{width:K,height:W,...SP({x:O.x??U.position.x,y:O.y??U.position.y},{width:K,height:W},U.parentId,L,I)}},ie=o_([B],L,D,T);M.push(...ie),j.x=O.x?Math.max(I[0]*K,O.x):void 0,j.y=O.y?Math.max(I[1]*W,O.y):void 0}if(j.x!==void 0&&j.y!==void 0){const I={id:b,type:"position",position:{...j}};M.push(I)}if(O.width!==void 0&&O.height!==void 0){const K={id:b,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};M.push(K)}for(const I of F){const K={...I,type:"position"};M.push(K)}q(M)},onEnd:({width:O,height:F})=>{const q={id:b,type:"dimensions",resizing:!1,dimensions:{width:O,height:F}};_.getState().triggerNodeChanges([q])}})),S.current.update({controlPosition:C,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:x,onResizeEnd:y,shouldResize:m}),()=>{var O;(O=S.current)==null||O.destroy()}},[C,o,c,u,d,f,g,x,y,m]);const R=C.split("-");return l.jsx("div",{className:zn(["react-flow__resize-control","nodrag",...R,n,r]),ref:k,style:{...s,scale:A,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}E.memo(vde);var D4=Object.defineProperty,_de=(e,t,n)=>t in e?D4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kde=(e,t)=>{for(var n in t)D4(e,n,{get:t[n],enumerable:!0})},Nde=(e,t,n)=>_de(e,t+"",n),P4={};kde(P4,{Graph:()=>zs,alg:()=>u_,json:()=>F4,version:()=>Ade});var Sde=Object.defineProperty,B4=(e,t)=>{for(var n in t)Sde(e,n,{get:t[n],enumerable:!0})},zs=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,i])=>{e(s)&&t.setNode(s,i)}),Object.values(this._edgeObjs).forEach(s=>{t.hasNode(s.v)&&t.hasNode(s.w)&&t.setEdge(s,this.edge(s))});let n={},r=s=>{let i=this.parent(s);return!i||t.hasNode(i)?(n[s]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(s=>t.setParent(s,r(s))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let s,i,a,o,c=!1;typeof e=="object"&&e!==null&&"v"in e?(s=e.v,i=e.w,a=e.name,arguments.length===2&&(o=t,c=!0)):(s=e,i=t,a=r,arguments.length>2&&(o=n,c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);let u=fd(this._isDirected,s,i,a);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=o),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[u]=c?o:this._defaultEdgeLabelFn(s,i,a);let d=Tde(this._isDirected,s,i,a);return s=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,HA(this._preds[i],s),HA(this._sucs[s],i),this._in[i][u]=d,this._out[s][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):fd(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?xb(this._isDirected,e):fd(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):fd(this._isDirected,e,t,n),s=this._edgeObjs[r];if(s){let i=s.v,a=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],zA(this._preds[a],i),zA(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(s=>s.v===t&&s.w===n||s.v===n&&s.w===t):r}};function HA(e,t){e[t]?e[t]++:e[t]=1}function zA(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function fd(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let a=s;s=i,i=a}return s+""+i+""+(r===void 0?"\0":r)}function Tde(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let o=s;s=i,i=o}let a={v:s,w:i};return r&&(a.name=r),a}function xb(e,t){return fd(e,t.v,t.w,t.name)}var Ade="4.0.1",F4={};B4(F4,{read:()=>Ode,write:()=>Cde});function Cde(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Ide(e),edges:Rde(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Ide(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),r!==void 0&&(s.parent=r),s})}function Rde(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Ode(e){let t=new zs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var u_={};B4(u_,{CycleException:()=>pg,bellmanFord:()=>U4,components:()=>jde,dijkstra:()=>hg,dijkstraAll:()=>Bde,findCycles:()=>Fde,floydWarshall:()=>$de,isAcyclic:()=>zde,postorder:()=>Kde,preorder:()=>Yde,prim:()=>Gde,shortestPaths:()=>Wde,tarjan:()=>H4,topsort:()=>z4});var Lde=()=>1;function U4(e,t,n,r){return Mde(e,String(t),n||Lde,r||function(s){return e.outEdges(s)})}function Mde(e,t,n,r){let s={},i,a=0,o=e.nodes(),c=function(f){let h=n(f);s[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let s=this._arr,i=s.length;return n[r]=i,s.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,s=e;n>1,!(t[r].priority1;function hg(e,t,n,r){let s=function(i){return e.outEdges(i)};return Pde(e,String(t),n||Dde,r||s)}function Pde(e,t,n,r){let s={},i=new $4,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=s[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=i.removeMin(),o=s[a],o.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return s}function Bde(e,t,n){return e.nodes().reduce(function(r,s){return r[s]=hg(e,s,t,n),r},{})}function H4(e){let t=0,n=[],r={},s=[];function i(a){let o=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(o.lowlink=Math.min(o.lowlink,r[c].index)):(i(c),o.lowlink=Math.min(o.lowlink,r[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in r||i(a)}),s}function Fde(e){return H4(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Ude=()=>1;function $de(e,t,n){return Hde(e,t||Ude,n||function(r){return e.outEdges(r)})}function Hde(e,t,n){let r={},s=e.nodes();return s.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},s.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let o=a.v===i?a.w:a.v,c=t(a);r[i][o]={distance:c,predecessor:i}})}),s.forEach(function(i){let a=r[i];s.forEach(function(o){let c=r[o];s.forEach(function(u){let d=c[i],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);s=V4(e,o,n==="post",a,i,r,s)}),s}function V4(e,t,n,r,s,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),s(t).forEach(function(o){a=V4(e,o,n,r,s,i,a)}),n&&(a=i(a,t))),a}function K4(e,t,n){return Vde(e,t,n,function(r,s){return r.push(s),r},[])}function Kde(e,t){return K4(e,t,"post")}function Yde(e,t){return K4(e,t,"pre")}function Gde(e,t){let n=new zs,r={},s=new $4,i;function a(c){let u=c.v===i?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(i=s.removeMin(),i in r)n.setEdge(i,r[i]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(i).forEach(a)}return n}function Wde(e,t,n,r){return qde(e,t,n,r??(s=>{let i=e.outEdges(s);return i??[]}))}function qde(e,t,n,r){if(n===void 0)return hg(e,t,n,r);let s=!1,i=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+s.weight,minlen:Math.max(r.minlen,s.minlen)})}),t}function Y4(e){let t=new zs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function VA(e,t){let n=e.x,r=e.y,s=t.x-n,i=t.y-r,a=e.width/2,o=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),c=o*s/i,u=o):(s<0&&(a=-a),c=a,u=a*i/s),{x:n+c,y:r+u}}function dh(e){let t=jf(W4(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),s=r.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][r.order]=n)}),t}function Qde(e){let t=e.nodes().map(r=>{let s=e.node(r).rank;return s===void 0?Number.MAX_VALUE:s}),n=Ii(Math.min,t);e.nodes().forEach(r=>{let s=e.node(r);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function Zde(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Ii(Math.min,t),r=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;r[o]||(r[o]=[]),r[o].push(a)});let s=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,o)=>{a===void 0&&o%i!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function KA(e,t,n,r){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=r),gu(e,"border",s,t)}function Jde(e,t=G4){let n=[];for(let r=0;rG4){let n=Jde(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function W4(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Ii(Math.max,t)}function efe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function q4(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function X4(e,t){return t()}var tfe=0;function d_(e){let t=++tfe;return e+(""+t)}function jf(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]:n=t,Object.entries(e).reduce((r,[s,i])=>(r[s]=n(i,s),r),{})}function nfe(e,t){return e.reduce((n,r,s)=>(n[r]=t[s],n),{})}var C0="\0",rfe="3.0.0",sfe=class{constructor(){Nde(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return YA(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&YA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,ife)),n=n._prev;return"["+e.join(", ")+"]"}};function YA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ife(e,t){if(e!=="_next"&&e!=="_prev")return t}var afe=sfe,ofe=()=>1;function lfe(e,t){if(e.nodeCount()<=1)return[];let n=ufe(e,t||ofe);return cfe(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function cfe(e,t,n){var r;let s=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)wb(e,t,n,o);for(;o=i.dequeue();)wb(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(r=t[c])==null?void 0:r.dequeue(),o){s=s.concat(wb(e,t,n,o,!0)||[]);break}}}return s}function wb(e,t,n,r,s){let i=[],a=s?i:void 0;return(e.inEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);s&&i.push({v:o.v,w:o.w}),u.out-=c,tx(t,n,u)}),(e.outEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,tx(t,n,d)}),e.removeNode(r.v),a}function ufe(e,t){let n=new zs,r=0,s=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);s=Math.max(s,f.out+=u),r=Math.max(r,h.in+=u)});let i=dfe(s+r+3).map(()=>new afe),a=r+1;return n.nodes().forEach(o=>{tx(i,a,n.node(o))}),{graph:n,buckets:i,zeroIdx:a}}function tx(e,t,n){var r,s,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(r=e[0])==null||r.enqueue(n)}function dfe(e){let t=[];for(let n=0;n{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,d_("rev"))});function t(n){return r=>n.edge(r).weight}}function hfe(e){let t=[],n={},r={};function s(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[i])}return e.nodes().forEach(s),t}function pfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function mfe(e){e.graph().dummyChains=[],e.edges().forEach(t=>gfe(e,t))}function gfe(e,t){let n=t.v,r=e.node(n).rank,s=t.w,i=e.node(s).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,s;for(e.setEdge(n.edgeObj,r);n.dummy;)s=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=s,n=e.node(t)})}function f_(e){let t={};function n(r){let s=e.node(r);if(Object.hasOwn(t,r))return s.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=Ii(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}e.sources().forEach(n)}function eu(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Q4=bfe;function bfe(e){let t=new zs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],s=e.nodeCount();t.setNode(r,{});let i,a;for(;Efe(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!eu(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function xfe(e,t){return t.edges().reduce((n,r)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(s=eu(t,r)),st.node(r).rank+=n)}var{preorder:vfe,postorder:_fe}=u_,kfe=bl;bl.initLowLimValues=p_;bl.initCutValues=h_;bl.calcCutValue=Z4;bl.leaveEdge=e6;bl.enterEdge=t6;bl.exchangeEdges=n6;function bl(e){e=Xde(e),f_(e);let t=Q4(e);p_(t),h_(t,e);let n,r;for(;n=e6(t);)r=t6(t,e,n),n6(t,e,n,r)}function h_(e,t){let n=_fe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Nfe(e,t,r))}function Nfe(e,t,n){let r=e.node(n).parent,s=e.edge(n,r);s.cutvalue=Z4(e,t,n)}function Z4(e,t,n){let r=e.node(n).parent,s=!0,i=t.edge(n,r),a=0;i||(s=!1,i=t.edge(r,n)),a=i.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,Tfe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function p_(e,t){arguments.length<2&&(t=e.nodes()[0]),J4(e,{},1,t)}function J4(e,t,n,r,s){let i=n,a=e.node(r);t[r]=!0;let o=e.neighbors(r);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=J4(e,t,n,c,r))}),a.low=i,a.lim=n++,s?a.parent=s:delete a.parent,n}function e6(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function t6(e,t,n){let r=n.v,s=n.w;t.hasEdge(r,s)||(r=n.w,s=n.v);let i=e.node(r),a=e.node(s),o=i,c=!1;return i.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===GA(e,e.node(u.v),o)&&c!==GA(e,e.node(u.w),o)).reduce((u,d)=>eu(t,d)!e.node(s).parent);if(!n)return;let r=vfe(e,[n]);r=r.slice(1),r.forEach(s=>{let i=e.node(s).parent,a=t.edge(s,i),o=!1;a||(a=t.edge(i,s),o=!0),t.node(s).rank=t.node(i).rank+(o?a.minlen:-a.minlen)})}function Tfe(e,t,n){return e.hasEdge(t,n)}function GA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Afe=Cfe;function Cfe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":WA(e);break;case"tight-tree":Rfe(e);break;case"longest-path":Ife(e);break;case"none":break;default:WA(e)}}var Ife=f_;function Rfe(e){f_(e),Q4(e)}function WA(e){kfe(e)}var Ofe=Lfe;function Lfe(e){let t=jfe(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),s=r.edgeObj,i=Mfe(e,t,s.v,s.w),a=i.path,o=i.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(r=e.node(n),d){for(;(u=a[c])!==o&&e.node(u).maxRanka||o>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:s.concat(i.reverse()),lca:u}}function jfe(e){let t={},n=0;function r(s){let i=n;e.children(s).forEach(r),t[s]={low:i,lim:n++}}return e.children(C0).forEach(r),t}function Dfe(e){let t=gu(e,"root",{},"_root"),n=Pfe(e),r=Object.values(n),s=Ii(Math.max,r)-1,i=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(o=>e.edge(o).minlen*=i);let a=Bfe(e)+1;e.children(C0).forEach(o=>r6(e,t,i,a,s,n,o)),e.graph().nodeRankFactor=i}function r6(e,t,n,r,s,i,a){var o;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=KA(e,"_bt"),d=KA(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;r6(e,t,n,r,s,i,h);let m=e.node(h),g=m.borderTop?m.borderTop:h,x=m.borderBottom?m.borderBottom:h,y=m.borderTop?r:2*r,w=g!==x?1:s-((p=i[a])!=null?p:0)+1;e.setEdge(u,g,{weight:y,minlen:w,nestingEdge:!0}),e.setEdge(x,d,{weight:y,minlen:w,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:s+((o=i[a])!=null?o:0)})}function Pfe(e){let t={};function n(r,s){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,s+1)),t[r]=s}return e.children(C0).forEach(r=>n(r,1)),t}function Bfe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Ffe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Ufe=$fe;function $fe(e){function t(n){let r=e.children(n),s=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let i=s.minRank,a=s.maxRank+1;iXA(e.node(t))),e.edges().forEach(t=>XA(e.edge(t)))}function XA(e){let t=e.width;e.width=e.height,e.height=t}function Vfe(e){e.nodes().forEach(t=>vb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(vb),Object.hasOwn(r,"y")&&vb(r)})}function vb(e){e.y=-e.y}function Kfe(e){e.nodes().forEach(t=>_b(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(_b),Object.hasOwn(r,"x")&&_b(r)})}function _b(e){let t=e.x;e.x=e.y,e.y=t}function Yfe(e){let t={},n=e.nodes().filter(o=>!e.children(o).length),r=n.map(o=>e.node(o).rank),s=Ii(Math.max,r),i=jf(s+1).map(()=>[]);function a(o){if(t[o])return;t[o]=!0;let c=e.node(o);i[c.rank].push(o);let u=e.successors(o);u&&u.forEach(a)}return n.sort((o,c)=>e.node(o).rank-e.node(c).rank).forEach(a),i}function Gfe(e,t){let n=0;for(let r=1;rd)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),i=1;for(;i{let d=u.pos+i;o[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=o[d+1]),d=d-1>>1,o[d]+=u.weight;c+=u.weight*f}),c}function qfe(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let s=r.reduce((i,a)=>{let o=e.edge(a),c=e.node(a.v);return{sum:i.sum+o.weight*c.order,weight:i.weight+o.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function Xfe(e,t){let n={};e.forEach((s,i)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let i=n[s.v],a=n[s.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(s=>!s.indegree);return Qfe(r)}function Qfe(e){let t=[];function n(s){return i=>{i.merged||(i.barycenter===void 0||s.barycenter===void 0||i.barycenter>=s.barycenter)&&Zfe(s,i)}}function r(s){return i=>{i.in.push(s),--i.indegree===0&&e.push(i)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(r(s))}return t.filter(s=>!s.merged).map(s=>mg(s,["vs","i","barycenter","weight"]))}function Zfe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Jfe(e,t){let n=efe(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),i=[],a=0,o=0,c=0;r.sort(ehe(!!t)),c=QA(i,s,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),a+=d.barycenter*d.weight,o+=d.weight,c=QA(i,s,c)});let u={vs:i.flat(1)};return o&&(u.barycenter=a/o,u.weight=o),u}function QA(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function ehe(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function i6(e,t,n,r){let s=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,o=i?i.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==o));let u=qfe(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=i6(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&nhe(h,p)}});let d=Xfe(u,n);the(d,c);let f=Jfe(d,r);if(a&&o){f.vs=[a,f.vs,o].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(o),g=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function the(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function nhe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function rhe(e,t,n,r){r||(r=e.nodes());let s=she(e),i=new zs({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let o=e.node(a),c=e.parent(a);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){i.setNode(a),i.setParent(a,c||s);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=i.edge(f,a),p=h!==void 0?h.weight:0;i.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),i}function she(e){let t;for(;e.hasNode(t=d_("_root")););return t}function ihe(e,t,n){let r={},s;n.forEach(i=>{let a=e.parent(i),o,c;for(;a;){if(o=e.parent(a),o?(c=r[o],r[o]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=o}})}function a6(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,a6);return}let n=W4(e),r=ZA(e,jf(1,n+1),"inEdges"),s=ZA(e,jf(n-1,-1,-1),"outEdges"),i=Yfe(e);if(JA(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,o,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){ahe(u%2?r:s,u%4>=2,c),i=dh(e);let f=Gfe(e,i);f{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&s(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let o=a.minRank;o<=a.maxRank;o++)o!==a.rank&&s(o,i)}return t.map(function(i){return rhe(e,i,n,r.get(i)||[])})}function ahe(e,t,n){let r=new zs;e.forEach(function(s){n.forEach(o=>r.setEdge(o.left,o.right));let i=s.graph().root,a=i6(s,i,r,t);a.vs.forEach((o,c)=>s.node(o).order=c),ihe(s,r,a.vs)})}function JA(e,t){Object.values(t).forEach(n=>n.forEach((r,s)=>e.node(r).order=s))}function ohe(e,t){let n={};function r(s,i){let a=0,o=0,c=s.length,u=i[i.length-1];return i.forEach((d,f)=>{let h=che(e,d),p=h?e.node(h).order:c;(h||d===u)&&(i.slice(o,f+1).forEach(m=>{let g=e.predecessors(m);g&&g.forEach(x=>{let y=e.node(x),w=y.order;(w{let f=i[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&o6(n,p,f)})}})}function s(i,a){let o=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,r(a,u,f,o,c),u=f,o=c}}r(a,u,a.length,c,i.length)}),a}return t.length&&t.reduce(s),n}function che(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function o6(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];r||(e[t]=r={}),r[n]=!0}function uhe(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function dhe(e,t,n,r){let s={},i={},a={};return t.forEach(o=>{o.forEach((c,u)=>{s[c]=c,i[c]=c,a[c]=u})}),t.forEach(o=>{let c=-1;o.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((p,m)=>{let g=a[p],x=a[m];return(g!==void 0?g:0)-(x!==void 0?x:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let g=f[p];if(g===void 0)continue;let x=a[g];if(x!==void 0&&i[u]===u&&c{var y;let w=(y=i[x.v])!=null?y:0,b=a.edge(x);return Math.max(g,w+(b!==void 0?b:0))},0):i[p]=0}function d(p){let m=a.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=m.reduce((y,w)=>{let b=i[w.w],_=a.edge(w);return Math.min(y,(b!==void 0?b:0)-(_!==void 0?_:0))},Number.POSITIVE_INFINITY));let x=e.node(p);g!==Number.POSITIVE_INFINITY&&x.borderType!==o&&(i[p]=Math.max(i[p]!==void 0?i[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var m;let g=n[p];g!==void 0&&(i[p]=(m=i[g])!=null?m:0)}),i}function hhe(e,t,n,r){let s=new zs,i=e.graph(),a=bhe(i.nodesep,i.edgesep,r);return t.forEach(o=>{let c;o.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function phe(e,t){return Object.values(t).reduce((n,r)=>{let s=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([o,c])=>{let u=Ehe(e,o)/2;s=Math.max(c+u,s),i=Math.min(c-u,i)});let a=s-i;return a{["l","r"].forEach(a=>{let o=i+a,c=e[o];if(!c||c===t)return;let u=Object.values(c),d=r-Ii(Math.min,u);a!=="l"&&(d=s-Ii(Math.max,u)),d&&(e[o]=A0(c,f=>f+d))})})}function ghe(e,t=void 0){let n=e.ul;return n?A0(n,(r,s)=>{var i,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let o=Object.values(e).map(c=>{let u=c[s];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=o[1])!=null?i:0)+((a=o[2])!=null?a:0))/2}):{}}function yhe(e){let t=dh(e),n=Object.assign(ohe(e,t),lhe(e,t)),r={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(o=>{o==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=dhe(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=fhe(e,s,c.root,c.align,o==="r");o==="r"&&(u=A0(u,d=>-d)),r[a+o]=u})});let i=phe(e,r);return mhe(r,i),ghe(r,e.graph().align)}function bhe(e,t,n){return(r,s,i)=>{let a=r.node(s),o=r.node(i),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(o.dummy?t:e)/2,c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(c+=n?u:-u),c}}function Ehe(e,t){return e.node(t).width}function xhe(e){e=Y4(e),whe(e),Object.entries(yhe(e)).forEach(([t,n])=>e.node(t).x=n)}function whe(e){let t=dh(e),n=e.graph(),r=n.ranksep,s=n.rankalign,i=0;t.forEach(a=>{let o=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);s==="top"?u.y=i+u.height/2:s==="bottom"?u.y=i+o-u.height/2:u.y=i+o/2}),i+=o+r})}function vhe(e,t={}){let n=t.debugTiming?q4:X4;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Ohe(e));return n(" runLayout",()=>_he(r,n,t)),n(" updateInputGraph",()=>khe(e,r)),r})}function _he(e,t,n){t(" makeSpaceForEdgeLabels",()=>Lhe(e)),t(" removeSelfEdges",()=>Hhe(e)),t(" acyclic",()=>ffe(e)),t(" nestingGraph.run",()=>Dfe(e)),t(" rank",()=>Afe(Y4(e))),t(" injectEdgeLabelProxies",()=>Mhe(e)),t(" removeEmptyRanks",()=>Zde(e)),t(" nestingGraph.cleanup",()=>Ffe(e)),t(" normalizeRanks",()=>Qde(e)),t(" assignRankMinMax",()=>jhe(e)),t(" removeEdgeLabelProxies",()=>Dhe(e)),t(" normalize.run",()=>mfe(e)),t(" parentDummyChains",()=>Ofe(e)),t(" addBorderSegments",()=>Ufe(e)),t(" order",()=>a6(e,n)),t(" insertSelfEdges",()=>zhe(e)),t(" adjustCoordinateSystem",()=>Hfe(e)),t(" position",()=>xhe(e)),t(" positionSelfEdges",()=>Vhe(e)),t(" removeBorderNodes",()=>$he(e)),t(" normalize.undo",()=>yfe(e)),t(" fixupEdgeLabelCoords",()=>Fhe(e)),t(" undoCoordinateSystem",()=>zfe(e)),t(" translateGraph",()=>Phe(e)),t(" assignNodeIntersects",()=>Bhe(e)),t(" reversePoints",()=>Uhe(e)),t(" acyclic.undo",()=>pfe(e))}function khe(e,t){e.nodes().forEach(n=>{let r=e.node(n),s=t.node(n);r&&(r.x=s.x,r.y=s.y,r.order=s.order,r.rank=s.rank,t.children(n).length&&(r.width=s.width,r.height=s.height))}),e.edges().forEach(n=>{let r=e.edge(n),s=t.edge(n);r.points=s.points,Object.hasOwn(s,"x")&&(r.x=s.x,r.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Nhe=["nodesep","edgesep","ranksep","marginx","marginy"],She={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},The=["acyclicer","ranker","rankdir","align","rankalign"],Ahe=["width","height","rank"],eC={width:0,height:0},Che=["minlen","weight","width","height","labeloffset"],Ihe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Rhe=["labelpos"];function Ohe(e){let t=new zs({multigraph:!0,compound:!0}),n=Nb(e.graph());return t.setGraph(Object.assign({},She,kb(n,Nhe),mg(n,The))),e.nodes().forEach(r=>{let s=Nb(e.node(r)),i=kb(s,Ahe);Object.keys(eC).forEach(o=>{i[o]===void 0&&(i[o]=eC[o])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let s=Nb(e.edge(r));t.setEdge(r,Object.assign({},Ihe,kb(s,Che),mg(s,Rhe)))}),t}function Lhe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Mhe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),s={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};gu(e,"edge-proxy",s,"_ep")}})}function jhe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Dhe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Phe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,s=0,i=e.graph(),a=i.marginx||0,o=i.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),s=Math.max(s,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=o,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+a,i.height=s-r+o}function Bhe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),s=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=s,a=r),n.points.unshift(VA(r,i)),n.points.push(VA(s,a))})}function Fhe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function Uhe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function $he(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),s=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(s.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Hhe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function zhe(e){dh(e).forEach(t=>{let n=0;t.forEach((r,s)=>{let i=e.node(r);i.order=s+n,(i.selfEdges||[]).forEach(a=>{gu(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Vhe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,s=e.node(r.e.v),i=s.x+s.width/2,a=s.y,o=n.x-i,c=s.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-c},{x:i+5*o/6,y:a-c},{x:i+o,y:a},{x:i+5*o/6,y:a+c},{x:i+2*o/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function kb(e,t){return A0(mg(e,t),Number)}function Nb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Khe(e){let t=dh(e),n=new zs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,s)=>{let i="layer"+s;n.setNode(i,{rank:"same"}),r.reduce((a,o)=>(n.setEdge(a,o,{style:"invis"}),o))}),n}var Yhe={graphlib:P4,version:rfe,layout:vhe,debug:Khe,util:{time:q4,notime:X4}},tC=Yhe;/*! For license information please see dagre.esm.js.LEGAL.txt */const hd={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:tl},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:sM},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:GL},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:nv},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:Xg}},nx=220,rx=88,nC=96,rC=34,gg=64,sC=310,ic=24,l6=56,sx=40,iC=40,Ghe=18,Whe=58,qhe=!1,Xhe=e=>e==="sequential"||e==="parallel"||e==="loop";function ix(e,t){const n=e.agentType??"llm";return Xhe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function ax(e,t=[],n="horizontal"){const r=e.agentType??"llm";if(!ix(e,t))return{width:nx,height:rx};const s=e.subAgents.map((d,f)=>ax(d,[...t,f],n)),i=s.length?Math.max(...s.map(d=>d.width)):0,a=s.length?Math.max(...s.map(d=>d.height)):0,o=s.length&&r!=="parallel"?l6:ic,c=n==="horizontal"?r!=="parallel":r==="parallel",u=s.length?r==="parallel"?Ghe+iC:r==="loop"?Whe:0:iC;return c?{width:Math.max(sC,s.reduce((d,f)=>d+f.width,0)+sx*Math.max(0,s.length-1)+o*2),height:gg+ic+a+u+ic}:{width:Math.max(sC,i+ic*2),height:gg+o+s.reduce((d,f)=>d+f.height,0)+sx*Math.max(0,s.length-1)+u+o}}function qu(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Qhe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function aC(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Xu(e,t,n,r){const s=(r==null?void 0:r.tone)==="sequential"?"hsl(213 40% 40%)":(r==null?void 0:r.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${r!=null&&r.loop?"-loop":""}`,source:e,target:t,sourceHandle:r!=null&&r.loop?"loop-source":void 0,targetHandle:r!=null&&r.loop?"loop-target":void 0,label:n,type:"insertStep",data:r?{insert:r.insert,loop:r.loop,tone:r.tone}:void 0,animated:r==null?void 0:r.loop,markerEnd:{type:Wc.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function oC(e,t){const n=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],r=[];function s(u,d,f,h,p){const m=u.agentType??"llm",g=qu(d);return ix(u,d)?(i(u,d,f,h,p),g):(n.push({id:g,type:"agent",parentId:f,extent:"parent",position:h,data:{kind:"agent",path:d,agent:u,title:m==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:m,description:u.description.trim()||hd[m].description,childCount:u.subAgents.length,containedIn:p}}),g)}function i(u,d,f,h={x:0,y:0},p){const m=u.agentType??"sequential",g=qu(d),x=ax(u,d,t);n.push({id:g,type:"group",parentId:f,extent:f?"parent":void 0,position:h,style:{width:x.width,height:x.height},data:{kind:"agent",path:d,agent:u,title:u.name.trim()||(d.length===0?"主 Agent":hd[m].label),pattern:m,description:u.description.trim()||hd[m].description,childCount:u.subAgents.length,containedIn:p,layoutWidth:x.width,layoutHeight:x.height}});const y=u.subAgents.map((N,A)=>ax(N,[...d,A],t)),w=y.length&&m!=="parallel"?l6:ic,b=t==="horizontal"?m!=="parallel":m==="parallel";let _=w;const k=u.subAgents.map((N,A)=>{const S=y[A],C=b?{x:_,y:gg+ic}:{x:(x.width-S.width)/2,y:gg+_};return _+=(b?S.width:S.height)+sx,s(N,[...d,A],g,C,m)});if(m==="sequential"||m==="loop"){for(let N=0;N1&&r.push(Xu(k[k.length-1],k[0],"继续循环",{loop:!0,tone:"loop"}))}return g}const a=(u,d)=>{const f=u.agentType??"llm",h=qu(d);if(ix(u,d))return i(u,d),[h];if(n.push({id:h,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:d,agent:u,title:f==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:f,description:u.description.trim()||hd[f].description,childCount:u.subAgents.length}}),u.subAgents.length===0)return[h];const p=[];return u.subAgents.forEach((m,g)=>{const x=[...d,g],y=qu(x);r.push(Xu(h,y,"调用",{insert:{parentPath:d,index:g}})),p.push(...a(m,x))}),p},o=qu([]),c=a(e,[]);return r.push(Xu("terminal-input",o)),c.forEach(u=>r.push(Xu(u,"terminal-output"))),Zhe(n,r,t)}function Zhe(e,t,n){const r=new tC.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=new Set(e.filter(i=>!i.parentId).map(i=>i.id));return e.filter(i=>!i.parentId).forEach(i=>{const a=i.data.kind==="terminal";r.setNode(i.id,{width:a?nC:i.data.layoutWidth??nx,height:a?rC:i.data.layoutHeight??rx})}),t.filter(i=>s.has(i.source)&&s.has(i.target)).forEach(i=>r.setEdge(i.source,i.target)),tC.layout(r),{nodes:e.map(i=>{if(i.parentId)return i;const a=r.node(i.id),o=i.data.kind==="terminal",c=o?nC:i.data.layoutWidth??nx,u=o?rC:i.data.layoutHeight??rx;return{...i,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const I0=E.createContext(null),R0=E.createContext("horizontal");function Jhe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,markerEnd:o,style:c,label:u,data:d}){const f=E.useContext(I0),[h,p]=E.useState(!1),[m,g,x]=dg({sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,offset:d!=null&&d.loop?28:20});return l.jsxs(l.Fragment,{children:[l.jsx(uh,{id:e,path:m,markerEnd:o,style:c}),f&&(d==null?void 0:d.insert)&&l.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&l.jsx(Wue,{children:l.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}px, ${x}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&l.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&l.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:l.jsx(ir,{})})]})})]})}function epe({data:e,selected:t}){const n=E.useContext(I0),r=E.useContext(R0),s=r==="vertical"?Ue.Top:Ue.Left,i=r==="vertical"?Ue.Bottom:Ue.Right,a=r==="vertical"?Ue.Right:Ue.Bottom,o=e.pattern??"llm",c=hd[o],u=c.icon;return l.jsxs("div",{className:`abc-node is-${o}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[l.jsx(kr,{type:"target",position:s,className:"abc-handle"}),o!=="llm"&&l.jsx("span",{className:"abc-node-icon",children:l.jsx(u,{})}),l.jsxs("span",{className:"abc-node-copy",children:[l.jsx("span",{className:"abc-node-meta",children:l.jsx("span",{children:c.label})}),l.jsx("strong",{children:e.title}),l.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(js,{})}),l.jsx(kr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(kr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function tpe({data:e,selected:t}){const n=E.useContext(I0),r=E.useContext(R0),s=r==="vertical"?Ue.Top:Ue.Left,i=r==="vertical"?Ue.Bottom:Ue.Right,a=r==="vertical"?Ue.Right:Ue.Bottom,o=e.pattern??"sequential",c=e.childCount??0,u=o==="llm"?"添加子 Agent":o==="parallel"?"添加一个同时处理的步骤":o==="loop"?"添加循环步骤":"添加下一个步骤";return l.jsxs("div",{className:`abc-group is-${o}${t?" is-selected":""}`,children:[l.jsx(kr,{type:"target",position:s,className:"abc-handle"}),l.jsx("header",{className:"abc-group-head",children:l.jsxs("span",{children:[l.jsx("strong",{title:e.title,children:e.title}),l.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&o!=="parallel"&&l.jsxs("div",{className:"abc-group-boundary-actions",children:[l.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:l.jsx(ir,{})}),l.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:l.jsx(ir,{})})]}),n&&e.path!==void 0&&c>0&&o==="parallel"&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(ir,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(ir,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(js,{})}),l.jsx(kr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(kr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function npe({data:e}){const t=E.useContext(R0);return l.jsxs("div",{className:"abc-terminal",children:[l.jsx(kr,{type:"target",position:t==="vertical"?Ue.Top:Ue.Left,className:"abc-handle"}),l.jsx("span",{children:e.title}),l.jsx(kr,{type:"source",position:t==="vertical"?Ue.Bottom:Ue.Right,className:"abc-handle"})]})}const rpe={agent:epe,group:tpe,terminal:npe},spe={insertStep:Jhe};function ipe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:s,onDelete:i,readOnly:a=!1,interactivePreview:o=!1,direction:c="horizontal"}){const u=E.useMemo(()=>oC(e,c),[]),[d,f,h]=C4(u.nodes),[p,m,g]=I4(u.edges),x=Xue(),y=E.useRef(`${c}:${aC(e)}`),w=E.useRef(null),{fitView:b}=S0(),_=E.useMemo(()=>oC(e,c),[c,e]),[k,N]=E.useState(()=>window.matchMedia("(max-width: 860px)").matches),A=E.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,a]),S=E.useCallback(()=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>void b(A))})},[A,b]);E.useEffect(()=>{const R=window.matchMedia("(max-width: 860px)"),O=F=>N(F.matches);return R.addEventListener("change",O),()=>R.removeEventListener("change",O)},[]),E.useEffect(()=>{const R=`${c}:${aC(e)}`,O=R!==y.current;y.current=R,m(_.edges),f(F=>{const q=new Map(F.map(L=>[L.id,L.position]));return _.nodes.map(L=>({...L,position:!O&&q.get(L.id)?q.get(L.id):L.position,selected:L.data.kind==="agent"&&!!L.data.path&&Qhe(L.data.path,t)}))}),O&&S()},[_,e,S,t,m,f]),E.useEffect(()=>{S()},[k,S]),E.useEffect(()=>{x&&S()},[_,S,x]),E.useEffect(()=>{if(!a||!w.current)return;const R=new ResizeObserver(()=>S());return R.observe(w.current),S(),()=>R.disconnect()},[S,a]);const C=E.useMemo(()=>a?null:{onAdd:r,onInsert:s,onDelete:i},[r,i,s,a]);return l.jsx(R0.Provider,{value:c,children:l.jsx(I0.Provider,{value:C,children:l.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:l.jsx("div",{ref:w,className:"abc-canvas",children:l.jsxs(A4,{nodes:d,edges:p,nodeTypes:rpe,edgeTypes:spe,onNodesChange:h,onEdgesChange:g,onNodeClick:(R,O)=>{!a&&O.data.kind==="agent"&&O.data.path&&n(O.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||o,zoomOnDoubleClick:o,zoomOnPinch:!a||o,zoomOnScroll:!a||o,fitView:!0,fitViewOptions:A,minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[l.jsx(O4,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||o)&&l.jsx(M4,{showInteractive:!1}),qhe]})})})})})}function yg(e){return l.jsx(c_,{children:l.jsx(ipe,{...e})})}const ape="doubao-seed-2-1-pro-260628",ope="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",lpe=`你是一个专业、可靠的智能助手。 +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return E.useEffect(()=>{const c=(t==null?void 0:t.target)??kA,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var x,y;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&AP(p))return!1;const g=SA(p.code,o);if(i.current.add(p[g]),NA(a,i.current,!1)){const w=((y=(x=p.composedPath)==null?void 0:x.call(p))==null?void 0:y[0])||p.target,b=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&p.preventDefault(),r(!0)}},f=p=>{const m=SA(p.code,o);NA(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function NA(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function SA(e,t){return t.includes(e)?"code":"key"}const Nce=()=>{const e=xn();return E.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),c=e_(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return gu(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Zc(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function e4(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...i};for(const c of a)Sce(c,o);n.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Sce(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function t4(e,t){return e4(e,t)}function n4(e,t){return e4(e,t)}function Ao(e,t){return{id:e,type:"select",selected:t}}function sc(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(Ao(i.id,a)))}return r}function TA({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=t.get(a.id),c=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function AA(e){return{id:e.id,type:"remove"}}const Tce=NP();function r4(e,t,n={}){return Joe(e,t,{...n,onError:n.onError??Tce})}const CA=e=>Boe(e),Ace=e=>wP(e);function s4(e){return E.forwardRef(e)}const Cce=typeof window<"u"?E.useLayoutEffect:E.useEffect;function IA(e){const[t,n]=E.useState(BigInt(0)),[r]=E.useState(()=>Ice(()=>n(s=>s+BigInt(1))));return Cce(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Ice(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const i4=E.createContext(null);function Rce({children:e}){const t=xn(),n=E.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let g=c;for(const y of o)g=typeof y=="function"?y(g):y;let x=TA({items:g,lookup:h});for(const y of m.values())x=y(x);d&&u(g),x.length>0?f==null||f(x):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:w,setNodes:b}=t.getState();y&&b(w)})},[]),r=IA(n),s=E.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(TA({items:p,lookup:h}))},[]),i=IA(s),a=E.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return l.jsx(i4.Provider,{value:a,children:e})}function Oce(){const e=E.useContext(i4);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Lce=e=>!!e.panZoom;function S0(){const e=Nce(),t=xn(),n=Oce(),r=Ot(Lce),s=E.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var y,w;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=CA(f)?f:h.get(f.id),g=m.parentId?SP(m.position,m.measured,m.parentId,h,p):m.position,x={...m,position:g,width:((y=m.measured)==null?void 0:y.width)??m.width,height:((w=m.measured)==null?void 0:w.height)??m.height};return Qc(x)},u=(f,h,p={replace:!1})=>{a(m=>m.map(g=>{if(g.id===f){const x=typeof h=="function"?h(g):h;return p.replace&&CA(x)?x:{...g,...x}}return g}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(g=>{if(g.id===f){const x=typeof h=="function"?h(g):h;return p.replace&&Ace(x)?x:{...g,...x}}return g}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,g,x]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:m,y:g,zoom:x}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:g,onEdgesDelete:x,triggerNodeChanges:y,triggerEdgeChanges:w,onDelete:b,onBeforeDelete:_}=t.getState(),{nodes:k,edges:N}=await zoe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),A=N.length>0,S=k.length>0;if(A){const C=N.map(AA);x==null||x(N),w(C)}if(S){const C=k.map(AA);g==null||g(k),y(C)}return(S||A)&&(b==null||b({nodes:k,edges:N})),{deletedNodes:k,deletedEdges:N}},getIntersectingNodes:(f,h=!0,p)=>{const m=iA(f),g=m?f:c(f),x=p!==void 0;return g?(p||t.getState().nodes).filter(y=>{const w=t.getState().nodeLookup.get(y.id);if(w&&!m&&(y.id===f.id||!w.internals.positionAbsolute))return!1;const b=Qc(x?y:w),_=Of(b,g);return h&&_>0||_>=b.width*b.height||_>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=iA(f)?f:c(f);if(!g)return!1;const x=Of(g,h);return p&&x>0||x>=h.width*h.height||x>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const g=typeof h=="function"?h(m):h;return p.replace?{...m,data:g}:{...m,data:{...m.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Foe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??Yoe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return E.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const RA=e=>e.selected,Mce=typeof window<"u"?window:void 0;function jce({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=xn(),{deleteElements:r}=S0(),s=Mf(e,{actInsideInputWithModifier:!1}),i=Mf(t,{target:Mce});E.useEffect(()=>{if(s){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(RA),edges:a.filter(RA)}),n.setState({nodesSelectionActive:!1})}},[s]),E.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Dce(e){const t=xn();E.useEffect(()=>{const n=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=n_(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",hi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const T0={position:"absolute",width:"100%",height:"100%",top:0,left:0},Pce=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Bce({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=qo.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:g,noPanClassName:x,onViewportChange:y,isControlledViewport:w,paneClickDistance:b,selectionOnDrag:_}){const k=xn(),N=E.useRef(null),{userSelectionActive:A,lib:S,connectionInProgress:C}=Ot(Pce,bn),R=Mf(h),O=E.useRef();Dce(N);const F=E.useCallback(q=>{y==null||y({x:q[0],y:q[1],zoom:q[2]}),w||k.setState({transform:q})},[y,w]);return E.useEffect(()=>{if(N.current){O.current=Cle({domNode:N.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:T=>k.setState(M=>M.paneDragging===T?M:{paneDragging:T}),onPanZoomStart:(T,M)=>{const{onViewportChangeStart:j,onMoveStart:U}=k.getState();U==null||U(T,M),j==null||j(M)},onPanZoom:(T,M)=>{const{onViewportChange:j,onMove:U}=k.getState();U==null||U(T,M),j==null||j(M)},onPanZoomEnd:(T,M)=>{const{onViewportChangeEnd:j,onMoveEnd:U}=k.getState();U==null||U(T,M),j==null||j(M)}});const{x:q,y:L,zoom:D}=O.current.getViewport();return k.setState({panZoom:O.current,transform:[q,L,D],domNode:N.current.closest(".react-flow")}),()=>{var T;(T=O.current)==null||T.destroy()}}},[]),E.useEffect(()=>{var q;(q=O.current)==null||q.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:R,preventScrolling:p,noPanClassName:x,userSelectionActive:A,noWheelClassName:g,lib:S,onTransformChange:F,connectionInProgress:C,selectionOnDrag:_,paneClickDistance:b})},[e,t,n,r,s,i,a,o,R,p,x,A,g,S,F,C,_,b]),l.jsx("div",{className:"react-flow__renderer",ref:N,style:T0,children:m})}const Fce=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Uce(){const{userSelectionActive:e,userSelectionRect:t}=Ot(Fce,bn);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const bb=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},$ce=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Hce({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Rf.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:g}){const x=E.useRef(0),y=xn(),{userSelectionActive:w,elementsSelectable:b,dragging:_,connectionInProgress:k,panBy:N,autoPanSpeed:A}=Ot($ce,bn),S=b&&(e||w),C=E.useRef(null),R=E.useRef(),O=E.useRef(new Set),F=E.useRef(new Set),q=E.useRef(!1),L=E.useRef({x:0,y:0}),D=E.useRef(!1),T=J=>{if(q.current||k){q.current=!1;return}u==null||u(J),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=J=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){J.preventDefault();return}d==null||d(J)},j=f?J=>f(J):void 0,U=J=>{q.current&&(J.stopPropagation(),q.current=!1)},I=J=>{var We,Ce;const{domNode:fe,transform:te}=y.getState();if(R.current=fe==null?void 0:fe.getBoundingClientRect(),!R.current)return;const ge=J.target===C.current;if(!ge&&!!J.target.closest(".nokey")||!e||!(a&&ge||t)||J.button!==0||!J.isPrimary)return;(Ce=(We=J.target)==null?void 0:We.setPointerCapture)==null||Ce.call(We,J.pointerId),q.current=!1;const{x:me,y:Ne}=ai(J.nativeEvent,R.current),Ie=gu({x:me,y:Ne},te);y.setState({userSelectionRect:{width:0,height:0,startX:Ie.x,startY:Ie.y,x:me,y:Ne}}),ge||(J.stopPropagation(),J.preventDefault())};function K(J,fe){const{userSelectionRect:te}=y.getState();if(!te)return;const{transform:ge,nodeLookup:we,edgeLookup:Z,connectionLookup:me,triggerNodeChanges:Ne,triggerEdgeChanges:Ie,defaultEdgeOptions:We}=y.getState(),Ce={x:te.startX,y:te.startY},{x:et,y:Ge}=Zc(Ce,ge),Xe={startX:Ce.x,startY:Ce.y,x:Jut.id)),F.current=new Set;const At=(We==null?void 0:We.selectable)??!0;for(const ut of O.current){const X=me.get(ut);if(X)for(const{edgeId:ne}of X.values()){const he=Z.get(ne);he&&(he.selectable??At)&&F.current.add(ne)}}if(!aA(xt,O.current)){const ut=sc(we,O.current,!0);Ne(ut)}if(!aA(gt,F.current)){const ut=sc(Z,F.current);Ie(ut)}y.setState({userSelectionRect:Xe,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!R.current)return;const[J,fe]=Jv(L.current,R.current,A);N({x:J,y:fe}).then(te=>{if(!q.current||!te){x.current=requestAnimationFrame(W);return}const{x:ge,y:we}=L.current;K(ge,we),x.current=requestAnimationFrame(W)})}const B=()=>{cancelAnimationFrame(x.current),x.current=0,D.current=!1};E.useEffect(()=>()=>B(),[]);const ie=J=>{const{userSelectionRect:fe,transform:te,resetSelectedElements:ge}=y.getState();if(!R.current||!fe)return;const{x:we,y:Z}=ai(J.nativeEvent,R.current);L.current={x:we,y:Z};const me=Zc({x:fe.startX,y:fe.startY},te);if(!q.current){const Ne=t?0:i;if(Math.hypot(we-me.x,Z-me.y)<=Ne)return;ge(),o==null||o(J)}q.current=!0,D.current||(W(),D.current=!0),K(we,Z)},Q=J=>{var fe,te;J.button===0&&((te=(fe=J.target)==null?void 0:fe.releasePointerCapture)==null||te.call(fe,J.pointerId),!w&&J.target===C.current&&y.getState().userSelectionRect&&(T==null||T(J)),y.setState({userSelectionActive:!1,userSelectionRect:null}),q.current&&(c==null||c(J),y.setState({nodesSelectionActive:O.current.size>0})),B())},ee=J=>{var fe,te;(te=(fe=J.target)==null?void 0:fe.releasePointerCapture)==null||te.call(fe,J.pointerId),B()},ce=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:zn(["react-flow__pane",{draggable:ce,dragging:_,selection:e}]),onClick:S?void 0:bb(T,C),onContextMenu:bb(M,C),onWheel:bb(j,C),onPointerEnter:S?void 0:h,onPointerMove:S?ie:p,onPointerUp:S?Q:void 0,onPointerCancel:S?ee:void 0,onPointerDownCapture:S?I:void 0,onClickCapture:S?U:void 0,onPointerLeave:m,ref:C,style:T0,children:[g,l.jsx(Uce,{})]})}function ex({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",hi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function a4({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=xn(),[c,u]=E.useState(!1),d=E.useRef();return E.useEffect(()=>{d.current=mle({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{ex({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),E.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const zce=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function o4(){const e=xn();return E.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=zce(a),p=s?i[0]:5,m=s?i[1]:5,g=n.direction.x*p*n.factor,x=n.direction.y*m*n.factor;for(const[,y]of u){if(!h(y))continue;let w={x:y.internals.positionAbsolute.x+g,y:y.internals.positionAbsolute.y+x};s&&(w=ch(w,i));const{position:b,positionAbsolute:_}=vP({nodeId:y.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});y.position=b,y.internals.positionAbsolute=_,f.set(y.id,y)}c(f)},[])}const l_=E.createContext(null),Vce=l_.Provider;l_.Consumer;const l4=()=>E.useContext(l_),Kce=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Yce=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Wc.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:d&&u}};function Gce({type:e="source",position:t=Ue.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var D,T;const m=a||null,g=e==="target",x=xn(),y=l4(),{connectOnClick:w,noPanClassName:b,rfId:_}=Ot(Kce,bn),{connectingFrom:k,connectingTo:N,clickConnecting:A,isPossibleEndHandle:S,connectionInProcess:C,clickConnectionInProcess:R,valid:O}=Ot(Yce(y,m,e),bn);y||(T=(D=x.getState()).onError)==null||T.call(D,"010",hi.error010());const F=M=>{const{defaultEdgeOptions:j,onConnect:U,hasDefaultEdges:I}=x.getState(),K={...j,...M};if(I){const{edges:W,setEdges:B,onError:ie}=x.getState();B(r4(K,W,{onError:ie}))}U==null||U(K),o==null||o(K)},q=M=>{if(!y)return;const j=CP(M.nativeEvent);if(s&&(j&&M.button===0||!j)){const U=x.getState();JE.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:g,handleId:m,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...I)=>{var K,W;return(W=(K=x.getState()).onConnectEnd)==null?void 0:W.call(K,...I)},updateConnection:U.updateConnection,onConnect:F,isValidConnection:n||((...I)=>{var K,W;return((W=(K=x.getState()).isValidConnection)==null?void 0:W.call(K,...I))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}j?d==null||d(M):f==null||f(M)},L=M=>{const{onClickConnectStart:j,onClickConnectEnd:U,connectionClickStartHandle:I,connectionMode:K,isValidConnection:W,lib:B,rfId:ie,nodeLookup:Q,connection:ee}=x.getState();if(!y||!I&&!s)return;if(!I){j==null||j(M.nativeEvent,{nodeId:y,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:y,type:e,id:m}});return}const ce=TP(M.target),J=n||W,{connection:fe,isValid:te}=JE.isValid(M.nativeEvent,{handle:{nodeId:y,id:m,type:e},connectionMode:K,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:J,flowId:ie,doc:ce,lib:B,nodeLookup:Q});te&&fe&&F(fe);const ge=structuredClone(ee);delete ge.inProgress,ge.toPosition=ge.toHandle?ge.toHandle.position:null,U==null||U(M,ge),x.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":m,"data-nodeid":y,"data-handlepos":t,"data-id":`${_}-${y}-${m}-${e}`,className:zn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!g,target:g,connectable:r,connectablestart:s,connectableend:i,clickconnecting:A,connectingfrom:k,connectingto:N,valid:O,connectionindicator:r&&(!C||S)&&(C||R?i:s)}]),onMouseDown:q,onTouchStart:q,onClick:w?L:void 0,ref:p,...h,children:c})}const kr=E.memo(s4(Gce));function Wce({data:e,isConnectable:t,sourcePosition:n=Ue.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(kr,{type:"source",position:n,isConnectable:t})]})}function qce({data:e,isConnectable:t,targetPosition:n=Ue.Top,sourcePosition:r=Ue.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(kr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(kr,{type:"source",position:r,isConnectable:t})]})}function Xce(){return null}function Qce({data:e,isConnectable:t,targetPosition:n=Ue.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(kr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const fg={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},OA={input:Wce,default:qce,output:Qce,group:Xce};function Zce(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Jce=e=>{const{width:t,height:n,x:r,y:s}=lh(e.nodeLookup,{filter:i=>!!i.selected});return{width:ii(t)?t:null,height:ii(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function eue({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xn(),{width:s,height:i,transformString:a,userSelectionActive:o}=Ot(Jce,bn),c=o4(),u=E.useRef(null);E.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&s!==null&&i!==null;if(a4({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(g=>g.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(fg,p.key)&&(p.preventDefault(),c({direction:fg[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:zn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const LA=typeof window<"u"?window:void 0,tue=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function c4({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:g,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:A,panOnDrag:S,autoPanOnSelection:C,defaultViewport:R,translateExtent:O,minZoom:F,maxZoom:q,preventScrolling:L,onSelectionContextMenu:D,noWheelClassName:T,noPanClassName:M,disableKeyboardA11y:j,onViewportChange:U,isControlledViewport:I}){const{nodesSelectionActive:K,userSelectionActive:W}=Ot(tue,bn),B=Mf(u,{target:LA}),ie=Mf(g,{target:LA}),Q=ie||S,ee=ie||_,ce=d&&Q!==!0,J=B||W||ce;return jce({deleteKeyCode:c,multiSelectionKeyCode:m}),l.jsx(Bce,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:ee,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:A,panOnDrag:!B&&Q,defaultViewport:R,translateExtent:O,minZoom:F,maxZoom:q,zoomActivationKeyCode:x,preventScrolling:L,noWheelClassName:T,noPanClassName:M,onViewportChange:U,isControlledViewport:I,paneClickDistance:o,selectionOnDrag:ce,children:l.jsxs(Hce,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:Q,autoPanOnSelection:C,isSelecting:!!J,selectionMode:f,selectionKeyPressed:B,paneClickDistance:o,selectionOnDrag:ce,children:[e,K&&l.jsx(eue,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:j})]})})}c4.displayName="FlowRenderer";const nue=E.memo(c4),rue=e=>t=>e?Zv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function sue(e){return Ot(E.useCallback(rue(e),[e]),bn)}const iue=e=>e.updateNodeInternals;function aue(){const e=Ot(iue),[t]=E.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return E.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function oue({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=xn(),i=E.useRef(null),a=E.useRef(null),o=E.useRef(e.sourcePosition),c=E.useRef(e.targetPosition),u=E.useRef(t),d=n&&!!e.internals.handleBounds;return E.useEffect(()=>{i.current&&!e.hidden&&(!d||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[d,e.hidden]),E.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),E.useEffect(()=>{if(i.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function lue({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:g,nodeTypes:x,nodeClickDistance:y,onError:w}){const{node:b,internals:_,isParent:k}=Ot(J=>{const fe=J.nodeLookup.get(e),te=J.parentLookup.has(e);return{node:fe,internals:fe.internals,isParent:te}},bn);let N=b.type||"default",A=(x==null?void 0:x[N])||OA[N];A===void 0&&(w==null||w("003",hi.error003(N)),N="default",A=(x==null?void 0:x.default)||OA.default);const S=!!(b.draggable||o&&typeof b.draggable>"u"),C=!!(b.selectable||c&&typeof b.selectable>"u"),R=!!(b.connectable||u&&typeof b.connectable>"u"),O=!!(b.focusable||d&&typeof b.focusable>"u"),F=xn(),q=t_(b),L=oue({node:b,nodeType:N,hasDimensions:q,resizeObserver:f}),D=a4({nodeRef:L,disabled:b.hidden||!S,noDragClassName:h,handleSelector:b.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),T=o4();if(b.hidden)return null;const M=ba(b),j=Zce(b),U=C||S||t||n||r||s,I=n?J=>n(J,{..._.userNode}):void 0,K=r?J=>r(J,{..._.userNode}):void 0,W=s?J=>s(J,{..._.userNode}):void 0,B=i?J=>i(J,{..._.userNode}):void 0,ie=a?J=>a(J,{..._.userNode}):void 0,Q=J=>{const{selectNodesOnDrag:fe,nodeDragThreshold:te}=F.getState();C&&(!fe||!S||te>0)&&ex({id:e,store:F,nodeRef:L}),t&&t(J,{..._.userNode})},ee=J=>{if(!(AP(J.nativeEvent)||m)){if(yP.includes(J.key)&&C){const fe=J.key==="Escape";ex({id:e,store:F,unselect:fe,nodeRef:L})}else if(S&&b.selected&&Object.prototype.hasOwnProperty.call(fg,J.key)){J.preventDefault();const{ariaLabelConfig:fe}=F.getState();F.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:J.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),T({direction:fg[J.key],factor:J.shiftKey?4:1})}}},ce=()=>{var me;if(m||!((me=L.current)!=null&&me.matches(":focus-visible")))return;const{transform:J,width:fe,height:te,autoPanOnNodeFocus:ge,setCenter:we}=F.getState();if(!ge)return;Zv(new Map([[e,b]]),{x:0,y:0,width:fe,height:te},J,!0).length>0||we(b.position.x+M.width/2,b.position.y+M.height/2,{zoom:J[2]})};return l.jsx("div",{className:zn(["react-flow__node",`react-flow__node-${N}`,{[p]:S},b.className,{selected:b.selected,selectable:C,parent:k,draggable:S,dragging:D}]),ref:L,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:q?"visible":"hidden",...b.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:K,onMouseLeave:W,onContextMenu:B,onClick:Q,onDoubleClick:ie,onKeyDown:O?ee:void 0,tabIndex:O?0:void 0,onFocus:O?ce:void 0,role:b.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${QP}-${g}`,"aria-label":b.ariaLabel,...b.domAttributes,children:l.jsx(Vce,{value:e,children:l.jsx(A,{id:e,data:b.data,type:N,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:b.selected??!1,selectable:C,draggable:S,deletable:b.deletable??!0,isConnectable:R,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:D,dragHandle:b.dragHandle,zIndex:_.z,parentId:b.parentId,...M})})})}var cue=E.memo(lue);const uue=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function u4(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Ot(uue,bn),a=sue(e.onlyRenderVisibleElements),o=aue();return l.jsx("div",{className:"react-flow__nodes",style:T0,children:a.map(c=>l.jsx(cue,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}u4.displayName="NodeRenderer";const due=E.memo(u4);function fue(e){return Ot(E.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&Xoe({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bn)}const hue=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},pue=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},MA={[qc.Arrow]:hue,[qc.ArrowClosed]:pue};function mue(e){const t=xn();return E.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(MA,e)?MA[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",hi.error009(e)),null)},[e])}const gue=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=mue(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},d4=({defaultColor:e,rfId:t})=>{const n=Ot(i=>i.edges),r=Ot(i=>i.defaultEdgeOptions),s=E.useMemo(()=>sle(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:s.map(i=>l.jsx(gue,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};d4.displayName="MarkerDefinitions";var yue=E.memo(d4);function f4({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=E.useState({x:1,y:0,width:0,height:0}),p=zn(["react-flow__edge-textwrapper",u]),m=E.useRef(null);return E.useEffect(()=>{if(m.current){const g=m.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),c]}):null}f4.displayName="EdgeText";const bue=E.memo(f4);function uh({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:zn(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&ii(t)&&ii(n)?l.jsx(bue,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function jA({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ue.Left||e===Ue.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function h4({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:i=Ue.Top}){const[a,o]=jA({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=jA({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=IP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${r},${s}`,d,f,h,p]}function p4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:y})=>{const[w,b,_]=h4({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),k=e.isInternal?void 0:t;return l.jsx(uh,{id:k,path:w,labelX:b,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:y})})}const Eue=p4({isInternal:!1}),m4=p4({isInternal:!0});Eue.displayName="SimpleBezierEdge";m4.displayName="SimpleBezierEdgeInternal";function g4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Ue.Bottom,targetPosition:m=Ue.Top,markerEnd:g,markerStart:x,pathOptions:y,interactionWidth:w})=>{const[b,_,k]=dg({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),N=e.isInternal?void 0:t;return l.jsx(uh,{id:N,path:b,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:x,interactionWidth:w})})}const y4=g4({isInternal:!1}),b4=g4({isInternal:!0});y4.displayName="SmoothStepEdge";b4.displayName="SmoothStepEdgeInternal";function E4(e){return E.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return l.jsx(y4,{...n,id:r,pathOptions:E.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const xue=E4({isInternal:!1}),x4=E4({isInternal:!0});xue.displayName="StepEdge";x4.displayName="StepEdgeInternal";function w4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})=>{const[x,y,w]=LP({sourceX:n,sourceY:r,targetX:s,targetY:i}),b=e.isInternal?void 0:t;return l.jsx(uh,{id:b,path:x,labelX:y,labelY:w,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:g})})}const wue=w4({isInternal:!1}),v4=w4({isInternal:!0});wue.displayName="StraightEdge";v4.displayName="StraightEdgeInternal";function _4(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ue.Bottom,targetPosition:o=Ue.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,pathOptions:y,interactionWidth:w})=>{const[b,_,k]=RP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:y==null?void 0:y.curvature}),N=e.isInternal?void 0:t;return l.jsx(uh,{id:N,path:b,labelX:_,labelY:k,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:g,markerStart:x,interactionWidth:w})})}const vue=_4({isInternal:!1}),k4=_4({isInternal:!0});vue.displayName="BezierEdge";k4.displayName="BezierEdgeInternal";const DA={default:k4,straight:v4,step:x4,smoothstep:b4,simplebezier:m4},PA={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},_ue=(e,t,n)=>n===Ue.Left?e-t:n===Ue.Right?e+t:e,kue=(e,t,n)=>n===Ue.Top?e-t:n===Ue.Bottom?e+t:e,BA="react-flow__edgeupdater";function FA({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:zn([BA,`${BA}-${o}`]),cx:_ue(t,r,e),cy:kue(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Nue({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=xn(),g=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:N,domNode:A,connectionMode:S,connectionRadius:C,lib:R,onConnectStart:O,cancelConnection:F,nodeLookup:q,rfId:L,panBy:D,updateConnection:T}=m.getState(),M=k.type==="target",j=(K,W)=>{h(!1),f==null||f(K,n,k.type,W)},U=K=>u==null?void 0:u(n,K),I=(K,W)=>{h(!0),d==null||d(_,n,k.type),O==null||O(K,W)};JE.onPointerDown(_.nativeEvent,{autoPanOnConnect:N,connectionMode:S,connectionRadius:C,domNode:A,handleId:k.id,nodeId:k.nodeId,nodeLookup:q,isTarget:M,edgeUpdaterType:k.type,lib:R,flowId:L,cancelConnection:F,panBy:D,isValidConnection:(...K)=>{var W,B;return((B=(W=m.getState()).isValidConnection)==null?void 0:B.call(W,...K))??!0},onConnect:U,onConnectStart:I,onConnectEnd:(...K)=>{var W,B;return(B=(W=m.getState()).onConnectEnd)==null?void 0:B.call(W,...K)},onReconnectEnd:j,updateConnection:T,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},x=_=>g(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=_=>g(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),w=()=>p(!0),b=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(FA,{position:o,centerX:r,centerY:s,radius:t,onMouseDown:x,onMouseEnter:w,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&l.jsx(FA,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:w,onMouseOut:b,type:"target"})]})}function Sue({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:g,noPanClassName:x,onError:y,disableKeyboardA11y:w}){let b=Ot(we=>we.edgeLookup.get(e));const _=Ot(we=>we.defaultEdgeOptions);b=_?{..._,...b}:b;let k=b.type||"default",N=(g==null?void 0:g[k])||DA[k];N===void 0&&(y==null||y("011",hi.error011(k)),k="default",N=(g==null?void 0:g.default)||DA.default);const A=!!(b.focusable||t&&typeof b.focusable>"u"),S=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),C=!!(b.selectable||r&&typeof b.selectable>"u"),R=E.useRef(null),[O,F]=E.useState(!1),[q,L]=E.useState(!1),D=xn(),{zIndex:T,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W}=Ot(E.useCallback(we=>{const Z=we.nodeLookup.get(b.source),me=we.nodeLookup.get(b.target);if(!Z||!me)return{zIndex:b.zIndex,...PA};const Ne=rle({id:e,sourceNode:Z,targetNode:me,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:we.connectionMode,onError:y});return{zIndex:qoe({selected:b.selected,zIndex:b.zIndex,sourceNode:Z,targetNode:me,elevateOnSelect:we.elevateEdgesOnSelect,zIndexMode:we.zIndexMode}),...Ne||PA}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),bn),B=E.useMemo(()=>b.markerStart?`url('#${QE(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ie=E.useMemo(()=>b.markerEnd?`url('#${QE(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||M===null||j===null||U===null||I===null)return null;const Q=we=>{var Ie;const{addSelectedEdges:Z,unselectNodesAndEdges:me,multiSelectionActive:Ne}=D.getState();C&&(D.setState({nodesSelectionActive:!1}),b.selected&&Ne?(me({nodes:[],edges:[b]}),(Ie=R.current)==null||Ie.blur()):Z([e])),s&&s(we,b)},ee=i?we=>{i(we,{...b})}:void 0,ce=a?we=>{a(we,{...b})}:void 0,J=o?we=>{o(we,{...b})}:void 0,fe=c?we=>{c(we,{...b})}:void 0,te=u?we=>{u(we,{...b})}:void 0,ge=we=>{var Z;if(!w&&yP.includes(we.key)&&C){const{unselectNodesAndEdges:me,addSelectedEdges:Ne}=D.getState();we.key==="Escape"?((Z=R.current)==null||Z.blur(),me({edges:[b]})):Ne([e])}};return l.jsx("svg",{style:{zIndex:T},children:l.jsxs("g",{className:zn(["react-flow__edge",`react-flow__edge-${k}`,b.className,x,{selected:b.selected,animated:b.animated,inactive:!C&&!s,updating:O,selectable:C}]),onClick:Q,onDoubleClick:ee,onContextMenu:ce,onMouseEnter:J,onMouseMove:fe,onMouseLeave:te,onKeyDown:A?ge:void 0,tabIndex:A?0:void 0,role:b.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":A?`${ZP}-${m}`:void 0,ref:R,...b.domAttributes,children:[!q&&l.jsx(N,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:C,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:B,markerEnd:ie,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),S&&l.jsx(Nue,{edge:b,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:M,sourceY:j,targetX:U,targetY:I,sourcePosition:K,targetPosition:W,setUpdateHover:F,setReconnecting:L})]})})}var Tue=E.memo(Sue);const Aue=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function N4({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:g}){const{edgesFocusable:x,edgesReconnectable:y,elementsSelectable:w,onError:b}=Ot(Aue,bn),_=fue(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(yue,{defaultColor:e,rfId:n}),_.map(k=>l.jsx(Tue,{id:k,edgesFocusable:x,edgesReconnectable:y,elementsSelectable:w,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:g},k))]})}N4.displayName="EdgeRenderer";const Cue=E.memo(N4),Iue=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Rue({children:e}){const t=Ot(Iue);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Oue(e){const t=S0(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Lue=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Mue(e){const t=Ot(Lue),n=xn();return E.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function jue(e){return e.connection.inProgress?{...e.connection,to:gu(e.connection.to,e.transform)}:{...e.connection}}function Due(e){return jue}function Pue(e){const t=Due();return Ot(t,bn)}const Bue=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Fue({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:c}=Ot(Bue,bn);return!(i&&s&&c)?null:l.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:zn(["react-flow__connection",xP(o)]),children:l.jsx(S4,{style:t,type:n,CustomComponent:r,isValid:o})})})}const S4=({style:e,type:t=Ua.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Pue();if(!s)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:xP(r),toNode:d,toHandle:f,pointer:p});let m="";const g={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Ua.Bezier:[m]=RP(g);break;case Ua.SimpleBezier:[m]=h4(g);break;case Ua.Step:[m]=dg({...g,borderRadius:0});break;case Ua.SmoothStep:[m]=dg(g);break;default:[m]=LP(g)}return l.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};S4.displayName="ConnectionLine";const Uue={};function UA(e=Uue){E.useRef(e),xn(),E.useEffect(()=>{},[e])}function $ue(){xn(),E.useRef(!1),E.useEffect(()=>{},[])}function T4({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:g,connectionLineComponent:x,connectionLineContainerStyle:y,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:A,deleteKeyCode:S,onlyRenderVisibleElements:C,elementsSelectable:R,defaultViewport:O,translateExtent:F,minZoom:q,maxZoom:L,preventScrolling:D,defaultMarkerColor:T,zoomOnScroll:M,zoomOnPinch:j,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:K,zoomOnDoubleClick:W,panOnDrag:B,autoPanOnSelection:ie,onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ce,onPaneMouseLeave:J,onPaneScroll:fe,onPaneContextMenu:te,paneClickDistance:ge,nodeClickDistance:we,onEdgeContextMenu:Z,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:Ie,reconnectRadius:We,onReconnect:Ce,onReconnectStart:et,onReconnectEnd:Ge,noDragClassName:Xe,noWheelClassName:xt,noPanClassName:gt,disableKeyboardA11y:At,nodeExtent:ut,rfId:X,viewport:ne,onViewportChange:he}){return UA(e),UA(t),$ue(),Oue(n),Mue(ne),l.jsx(nue,{onPaneClick:Q,onPaneMouseEnter:ee,onPaneMouseMove:ce,onPaneMouseLeave:J,onPaneContextMenu:te,onPaneScroll:fe,paneClickDistance:ge,deleteKeyCode:S,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:A,elementsSelectable:R,zoomOnScroll:M,zoomOnPinch:j,zoomOnDoubleClick:W,panOnScroll:U,panOnScrollSpeed:I,panOnScrollMode:K,panOnDrag:B,autoPanOnSelection:ie,defaultViewport:O,translateExtent:F,minZoom:q,maxZoom:L,onSelectionContextMenu:f,preventScrolling:D,noDragClassName:Xe,noWheelClassName:xt,noPanClassName:gt,disableKeyboardA11y:At,onViewportChange:he,isControlledViewport:!!ne,children:l.jsxs(Rue,{children:[l.jsx(Cue,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ce,onReconnectStart:et,onReconnectEnd:Ge,onlyRenderVisibleElements:C,onEdgeContextMenu:Z,onEdgeMouseEnter:me,onEdgeMouseMove:Ne,onEdgeMouseLeave:Ie,reconnectRadius:We,defaultMarkerColor:T,noPanClassName:gt,disableKeyboardA11y:At,rfId:X}),l.jsx(Fue,{style:g,type:m,component:x,containerStyle:y}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(due,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:we,onlyRenderVisibleElements:C,noPanClassName:gt,noDragClassName:Xe,disableKeyboardA11y:At,nodeExtent:ut,rfId:X}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}T4.displayName="GraphView";const Hue=E.memo(T4),zue=NP(),$A=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,g=new Map,x=new Map,y=r??t??[],w=n??e??[],b=d??[0,0],_=f??If;DP(g,x,y);const{nodesInitialized:k}=ZE(w,p,m,{nodeOrigin:b,nodeExtent:_,zIndexMode:h});let N=[0,0,1];if(a&&s&&i){const A=lh(p,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:S,y:C,zoom:R}=e_(A,s,i,c,u,(o==null?void 0:o.padding)??.1);N=[S,C,R]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:w,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:y,edgeLookup:x,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:If,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Wc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...EP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:zue,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bP,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Vue=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>ace((p,m)=>{async function g(){const{nodeLookup:x,panZoom:y,fitViewOptions:w,fitViewResolver:b,width:_,height:k,minZoom:N,maxZoom:A}=m();y&&(await Hoe({nodes:x,width:_,height:k,panZoom:y,minZoom:N,maxZoom:A},w),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...$A({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:x=>{const{nodeLookup:y,parentLookup:w,nodeOrigin:b,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:N,nodesSelectionActive:A}=m(),{nodesInitialized:S,hasSelectedNodes:C}=ZE(x,y,w,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:N}),R=A&&C;k&&S?(g(),p({nodes:x,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:R})):p({nodes:x,nodesInitialized:S,nodesSelectionActive:R})},setEdges:x=>{const{connectionLookup:y,edgeLookup:w}=m();DP(y,w,x),p({edges:x})},setDefaultNodesAndEdges:(x,y)=>{if(x){const{setNodes:w}=m();w(x),p({hasDefaultNodes:!0})}if(y){const{setEdges:w}=m();w(y),p({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:y,nodeLookup:w,parentLookup:b,domNode:_,nodeOrigin:k,nodeExtent:N,debug:A,fitViewQueued:S,zIndexMode:C}=m(),{changes:R,updatedInternals:O}=dle(x,w,b,_,k,N,C);O&&(ole(w,b,{nodeOrigin:k,nodeExtent:N,zIndexMode:C}),S?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(R==null?void 0:R.length)>0&&(A&&console.log("React Flow: trigger node changes",R),y==null||y(R)))},updateNodePositions:(x,y=!1)=>{const w=[];let b=[];const{nodeLookup:_,triggerNodeChanges:k,connection:N,updateConnection:A,onNodesChangeMiddlewareMap:S}=m();for(const[C,R]of x){const O=_.get(C),F=!!(O!=null&&O.expandParent&&(O!=null&&O.parentId)&&(R!=null&&R.position)),q={id:C,type:"position",position:F?{x:Math.max(0,R.position.x),y:Math.max(0,R.position.y)}:R.position,dragging:y};if(O&&N.inProgress&&N.fromNode.id===O.id){const L=cl(O,N.fromHandle,Ue.Left,!0);A({...N,from:L})}F&&O.parentId&&w.push({id:C,parentId:O.parentId,rect:{...R.internals.positionAbsolute,width:R.measured.width??0,height:R.measured.height??0}}),b.push(q)}if(w.length>0){const{parentLookup:C,nodeOrigin:R}=m(),O=o_(w,_,C,R);b.push(...O)}for(const C of S.values())b=C(b);k(b)},triggerNodeChanges:x=>{const{onNodesChange:y,setNodes:w,nodes:b,hasDefaultNodes:_,debug:k}=m();if(x!=null&&x.length){if(_){const N=t4(x,b);w(N)}k&&console.log("React Flow: trigger node changes",x),y==null||y(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:y,setEdges:w,edges:b,hasDefaultEdges:_,debug:k}=m();if(x!=null&&x.length){if(_){const N=n4(x,b);w(N)}k&&console.log("React Flow: trigger edge changes",x),y==null||y(x)}},addSelectedNodes:x=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(y){const N=x.map(A=>Ao(A,!0));_(N);return}_(sc(b,new Set([...x]),!0)),k(sc(w))},addSelectedEdges:x=>{const{multiSelectionActive:y,edgeLookup:w,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(y){const N=x.map(A=>Ao(A,!0));k(N);return}k(sc(w,new Set([...x]))),_(sc(b,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:y}={})=>{const{edges:w,nodes:b,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:N}=m(),A=x||b,S=y||w,C=[];for(const O of A){if(!O.selected)continue;const F=_.get(O.id);F&&(F.selected=!1),C.push(Ao(O.id,!1))}const R=[];for(const O of S)O.selected&&R.push(Ao(O.id,!1));k(C),N(R)},setMinZoom:x=>{const{panZoom:y,maxZoom:w}=m();y==null||y.setScaleExtent([x,w]),p({minZoom:x})},setMaxZoom:x=>{const{panZoom:y,minZoom:w}=m();y==null||y.setScaleExtent([w,x]),p({maxZoom:x})},setTranslateExtent:x=>{var y;(y=m().panZoom)==null||y.setTranslateExtent(x),p({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:y,triggerNodeChanges:w,triggerEdgeChanges:b,elementsSelectable:_}=m();if(!_)return;const k=y.reduce((A,S)=>S.selected?[...A,Ao(S.id,!1)]:A,[]),N=x.reduce((A,S)=>S.selected?[...A,Ao(S.id,!1)]:A,[]);w(k),b(N)},setNodeExtent:x=>{const{nodes:y,nodeLookup:w,parentLookup:b,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:N,zIndexMode:A}=m();x[0][0]===N[0][0]&&x[0][1]===N[0][1]&&x[1][0]===N[1][0]&&x[1][1]===N[1][1]||(ZE(y,w,b,{nodeOrigin:_,nodeExtent:x,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:A}),p({nodeExtent:x}))},panBy:x=>{const{transform:y,width:w,height:b,panZoom:_,translateExtent:k}=m();return fle({delta:x,panZoom:_,transform:y,translateExtent:k,width:w,height:b})},setCenter:async(x,y,w)=>{const{width:b,height:_,maxZoom:k,panZoom:N}=m();if(!N)return!1;const A=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:k;return await N.setViewport({x:b/2-x*A,y:_/2-y*A,zoom:A},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),!0},cancelConnection:()=>{p({connection:{...EP}})},updateConnection:x=>{p({connection:x})},reset:()=>p({...$A()})}},Object.is);function c_({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=E.useState(()=>Vue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(oce,{value:m,children:l.jsx(Rce,{children:p})})}function Kue({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return E.useContext(k0)?l.jsx(l.Fragment,{children:e}):l.jsx(c_,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Yue={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Gue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:y,onNodeMouseEnter:w,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:A,onNodeDrag:S,onNodeDragStop:C,onNodesDelete:R,onEdgesDelete:O,onDelete:F,onSelectionChange:q,onSelectionDragStart:L,onSelectionDrag:D,onSelectionDragStop:T,onSelectionContextMenu:M,onSelectionStart:j,onSelectionEnd:U,onBeforeDelete:I,connectionMode:K,connectionLineType:W=Ua.Bezier,connectionLineStyle:B,connectionLineComponent:ie,connectionLineContainerStyle:Q,deleteKeyCode:ee="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:J=!1,selectionMode:fe=Rf.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ge=Lf()?"Meta":"Control",zoomActivationKeyCode:we=Lf()?"Meta":"Control",snapToGrid:Z,snapGrid:me,onlyRenderVisibleElements:Ne=!1,selectNodesOnDrag:Ie,nodesDraggable:We,autoPanOnNodeFocus:Ce,nodesConnectable:et,nodesFocusable:Ge,nodeOrigin:Xe=JP,edgesFocusable:xt,edgesReconnectable:gt,elementsSelectable:At=!0,defaultViewport:ut=xce,minZoom:X=.5,maxZoom:ne=2,translateExtent:he=If,preventScrolling:Te=!0,nodeExtent:He,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:Ut=!0,zoomOnPinch:Ye=!0,panOnScroll:De=!1,panOnScrollSpeed:Be=.5,panOnScrollMode:Ct=qo.Free,zoomOnDoubleClick:un=!0,panOnDrag:$t=!0,onPaneClick:wn,onPaneMouseEnter:Fe,onPaneMouseMove:dt,onPaneMouseLeave:Lt,onPaneScroll:_t,onPaneContextMenu:be,paneClickDistance:Ve=1,nodeClickDistance:st=0,children:sn,onReconnect:an,onReconnectStart:Ht,onReconnectEnd:zt,onEdgeContextMenu:Bt,onEdgeDoubleClick:qt,onEdgeMouseEnter:vn,onEdgeMouseMove:Xt,onEdgeMouseLeave:Ln,reconnectRadius:Mn=10,onNodesChange:ue,onEdgesChange:_e,noDragClassName:ve="nodrag",noWheelClassName:ye="nowheel",noPanClassName:nt="nopan",fitView:Qe,fitViewOptions:ct,connectOnClick:ot,attributionPosition:oe,proOptions:Ze,defaultEdgeOptions:It,elevateNodesOnSelect:it=!0,elevateEdgesOnSelect:kt=!1,disableKeyboardA11y:Ft=!1,autoPanOnConnect:Zn,autoPanOnNodeDrag:or,autoPanOnSelection:lr=!0,autoPanSpeed:dn,connectionRadius:Zt,isValidConnection:Yt,onError:Jt,style:Mt,id:Cn,nodeDragThreshold:fn,connectionDragThreshold:en,viewport:Vn,onViewportChange:hn,width:gr,height:Kn,colorMode:bs="light",debug:yr,onScroll:es,ariaLabelConfig:Es,zIndexMode:bi="basic",...po},xs){const Ei=Cn||"1",$i=kce(bs),Ur=E.useCallback(Ar=>{Ar.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),es==null||es(Ar)},[es]);return l.jsx("div",{"data-testid":"rf__wrapper",...po,onScroll:Ur,style:{...Mt,...Yue},ref:xs,className:zn(["react-flow",s,$i]),id:Cn,role:"application",children:l.jsxs(Kue,{nodes:e,edges:t,width:gr,height:Kn,fitView:Qe,fitViewOptions:ct,minZoom:X,maxZoom:ne,nodeOrigin:Xe,nodeExtent:He,zIndexMode:bi,children:[l.jsx(_ce,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:g,onClickConnectStart:x,onClickConnectEnd:y,nodesDraggable:We,autoPanOnNodeFocus:Ce,nodesConnectable:et,nodesFocusable:Ge,edgesFocusable:xt,edgesReconnectable:gt,elementsSelectable:At,elevateNodesOnSelect:it,elevateEdgesOnSelect:kt,minZoom:X,maxZoom:ne,nodeExtent:He,onNodesChange:ue,onEdgesChange:_e,snapToGrid:Z,snapGrid:me,connectionMode:K,translateExtent:he,connectOnClick:ot,defaultEdgeOptions:It,fitView:Qe,fitViewOptions:ct,onNodesDelete:R,onEdgesDelete:O,onDelete:F,onNodeDragStart:A,onNodeDrag:S,onNodeDragStop:C,onSelectionDrag:D,onSelectionDragStart:L,onSelectionDragStop:T,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:nt,nodeOrigin:Xe,rfId:Ei,autoPanOnConnect:Zn,autoPanOnNodeDrag:or,autoPanSpeed:dn,onError:Jt,connectionRadius:Zt,isValidConnection:Yt,selectNodesOnDrag:Ie,nodeDragThreshold:fn,connectionDragThreshold:en,onBeforeDelete:I,debug:yr,ariaLabelConfig:Es,zIndexMode:bi}),l.jsx(Hue,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:W,connectionLineStyle:B,connectionLineComponent:ie,connectionLineContainerStyle:Q,selectionKeyCode:ce,selectionOnDrag:J,selectionMode:fe,deleteKeyCode:ee,multiSelectionKeyCode:ge,panActivationKeyCode:te,zoomActivationKeyCode:we,onlyRenderVisibleElements:Ne,defaultViewport:ut,translateExtent:he,minZoom:X,maxZoom:ne,preventScrolling:Te,zoomOnScroll:Ut,zoomOnPinch:Ye,zoomOnDoubleClick:un,panOnScroll:De,panOnScrollSpeed:Be,panOnScrollMode:Ct,panOnDrag:$t,autoPanOnSelection:lr,onPaneClick:wn,onPaneMouseEnter:Fe,onPaneMouseMove:dt,onPaneMouseLeave:Lt,onPaneScroll:_t,onPaneContextMenu:be,paneClickDistance:Ve,nodeClickDistance:st,onSelectionContextMenu:M,onSelectionStart:j,onSelectionEnd:U,onReconnect:an,onReconnectStart:Ht,onReconnectEnd:zt,onEdgeContextMenu:Bt,onEdgeDoubleClick:qt,onEdgeMouseEnter:vn,onEdgeMouseMove:Xt,onEdgeMouseLeave:Ln,reconnectRadius:Mn,defaultMarkerColor:qe,noDragClassName:ve,noWheelClassName:ye,noPanClassName:nt,rfId:Ei,disableKeyboardA11y:Ft,nodeExtent:He,viewport:Vn,onViewportChange:hn}),l.jsx(Ece,{onSelectionChange:q}),sn,l.jsx(pce,{proOptions:Ze,position:oe}),l.jsx(hce,{rfId:Ei,disableKeyboardA11y:Ft})]})})}var A4=s4(Gue);const Wue=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function que({children:e}){const t=Ot(Wue);return t?Us.createPortal(e,t):null}function C4(e){const[t,n]=E.useState(e),r=E.useCallback(s=>n(i=>t4(s,i)),[]);return[t,n,r]}function I4(e){const[t,n]=E.useState(e),r=E.useCallback(s=>n(i=>n4(s,i)),[]);return[t,n,r]}const Xue=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!t_(n.userNode))return!1;return!0};function Que(e={includeHiddenNodes:!1}){return Ot(Xue(e))}function Zue({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:zn(["react-flow__background-pattern",n,r])})}function Jue({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:zn(["react-flow__background-pattern","dots",t])})}var eo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(eo||(eo={}));const ede={[eo.Dots]:1,[eo.Lines]:1,[eo.Cross]:6},tde=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function R4({id:e,variant:t=eo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=E.useRef(null),{transform:h,patternId:p}=Ot(tde,bn),m=r||ede[t],g=t===eo.Dots,x=t===eo.Cross,y=Array.isArray(n)?n:[n,n],w=[y[0]*h[2]||1,y[1]*h[2]||1],b=m*h[2],_=Array.isArray(i)?i:[i,i],k=x?[b,b]:w,N=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],A=`${p}${e||""}`;return l.jsxs("svg",{className:zn(["react-flow__background",u]),style:{...c,...T0,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:A,x:h[0]%w[0],y:h[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:g?l.jsx(Jue,{radius:b/2,className:d}):l.jsx(Zue,{dimensions:k,lineWidth:s,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}R4.displayName="Background";const O4=E.memo(R4);function nde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function rde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function sde(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function ide(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ade(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function wp({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:zn(["react-flow__controls-button",t]),...n,children:e})}const ode=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function L4({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=xn(),{isInteractive:g,minZoomReached:x,maxZoomReached:y,ariaLabelConfig:w}=Ot(ode,bn),{zoomIn:b,zoomOut:_,fitView:k}=S0(),N=()=>{b(),i==null||i()},A=()=>{_(),a==null||a()},S=()=>{k(s),o==null||o()},C=()=>{m.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},R=h==="horizontal"?"horizontal":"vertical";return l.jsxs(N0,{className:zn(["react-flow__controls",R,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??w["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(wp,{onClick:N,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:y,children:l.jsx(nde,{})}),l.jsx(wp,{onClick:A,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:l.jsx(rde,{})})]}),n&&l.jsx(wp,{className:"react-flow__controls-fitview",onClick:S,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:l.jsx(sde,{})}),r&&l.jsx(wp,{className:"react-flow__controls-interactive",onClick:C,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:g?l.jsx(ade,{}):l.jsx(ide,{})}),d]})}L4.displayName="Controls";const M4=E.memo(L4);function lde({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:g}=i||{},x=a||m||g;return l.jsx("rect",{className:zn(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:x,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const cde=E.memo(lde),ude=e=>e.nodes.map(t=>t.id),Eb=e=>e instanceof Function?e:()=>e;function dde({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=cde,onClick:a}){const o=Ot(ude,bn),c=Eb(t),u=Eb(e),d=Eb(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(hde,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},h))})}function fde({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=Ot(m=>{const g=m.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const x=g.internals.userNode,{x:y,y:w}=g.internals.positionAbsolute,{width:b,height:_}=ba(x);return{node:x,x:y,y:w,width:b,height:_}},bn);return!u||u.hidden||!t_(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const hde=E.memo(fde);var pde=E.memo(dde);const mde=200,gde=150,yde=e=>!e.hidden,bde=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?kP(lh(e.nodeLookup,{filter:yde}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ede="react-flow__minimap-desc";function j4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:g=!1,zoomable:x=!1,ariaLabel:y,inversePan:w,zoomStep:b=1,offsetScale:_=5}){const k=xn(),N=E.useRef(null),{boundingRect:A,viewBB:S,rfId:C,panZoom:R,translateExtent:O,flowWidth:F,flowHeight:q,ariaLabelConfig:L}=Ot(bde,bn),D=(e==null?void 0:e.width)??mde,T=(e==null?void 0:e.height)??gde,M=A.width/D,j=A.height/T,U=Math.max(M,j),I=U*D,K=U*T,W=_*U,B=A.x-(I-A.width)/2-W,ie=A.y-(K-A.height)/2-W,Q=I+W*2,ee=K+W*2,ce=`${Ede}-${C}`,J=E.useRef(0),fe=E.useRef();J.current=U,E.useEffect(()=>{if(N.current&&R)return fe.current=wle({domNode:N.current,panZoom:R,getTransform:()=>k.getState().transform,getViewScale:()=>J.current}),()=>{var Z;(Z=fe.current)==null||Z.destroy()}},[R]),E.useEffect(()=>{var Z;(Z=fe.current)==null||Z.update({translateExtent:O,width:F,height:q,inversePan:w,pannable:g,zoomStep:b,zoomable:x})},[g,x,w,b,O,F,q]);const te=p?Z=>{var Ie;const[me,Ne]=((Ie=fe.current)==null?void 0:Ie.pointer(Z))||[0,0];p(Z,{x:me,y:Ne})}:void 0,ge=m?E.useCallback((Z,me)=>{const Ne=k.getState().nodeLookup.get(me).internals.userNode;m(Z,Ne)},[]):void 0,we=y??L["minimap.ariaLabel"];return l.jsx(N0,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*U:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:zn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:D,height:T,viewBox:`${B} ${ie} ${Q} ${ee}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:N,onClick:te,children:[we&&l.jsx("title",{id:ce,children:we}),l.jsx(pde,{onClick:ge,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-W},${ie-W}h${Q+W*2}v${ee+W*2}h${-Q-W*2}z + M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}j4.displayName="MiniMap";const xde=E.memo(j4),wde=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,vde={[Jc.Line]:"right",[Jc.Handle]:"bottom-right"};function _de({nodeId:e,position:t,variant:n=Jc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:g,onResize:x,onResizeEnd:y}){const w=l4(),b=typeof e=="string"?e:w,_=xn(),k=E.useRef(null),N=n===Jc.Handle,A=Ot(E.useCallback(wde(N&&p),[N,p]),bn),S=E.useRef(null),C=t??vde[n];E.useEffect(()=>{if(!(!k.current||!b))return S.current||(S.current=Mle({domNode:k.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:O,transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D,domNode:T}=_.getState();return{nodeLookup:O,transform:F,snapGrid:q,snapToGrid:L,nodeOrigin:D,paneDomNode:T}},onChange:(O,F)=>{const{triggerNodeChanges:q,nodeLookup:L,parentLookup:D,nodeOrigin:T}=_.getState(),M=[],j={x:O.x,y:O.y},U=L.get(b);if(U&&U.expandParent&&U.parentId){const I=U.origin??T,K=O.width??U.measured.width??0,W=O.height??U.measured.height??0,B={id:U.id,parentId:U.parentId,rect:{width:K,height:W,...SP({x:O.x??U.position.x,y:O.y??U.position.y},{width:K,height:W},U.parentId,L,I)}},ie=o_([B],L,D,T);M.push(...ie),j.x=O.x?Math.max(I[0]*K,O.x):void 0,j.y=O.y?Math.max(I[1]*W,O.y):void 0}if(j.x!==void 0&&j.y!==void 0){const I={id:b,type:"position",position:{...j}};M.push(I)}if(O.width!==void 0&&O.height!==void 0){const K={id:b,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};M.push(K)}for(const I of F){const K={...I,type:"position"};M.push(K)}q(M)},onEnd:({width:O,height:F})=>{const q={id:b,type:"dimensions",resizing:!1,dimensions:{width:O,height:F}};_.getState().triggerNodeChanges([q])}})),S.current.update({controlPosition:C,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:x,onResizeEnd:y,shouldResize:m}),()=>{var O;(O=S.current)==null||O.destroy()}},[C,o,c,u,d,f,g,x,y,m]);const R=C.split("-");return l.jsx("div",{className:zn(["react-flow__resize-control","nodrag",...R,n,r]),ref:k,style:{...s,scale:A,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}E.memo(_de);var D4=Object.defineProperty,kde=(e,t,n)=>t in e?D4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nde=(e,t)=>{for(var n in t)D4(e,n,{get:t[n],enumerable:!0})},Sde=(e,t,n)=>kde(e,t+"",n),P4={};Nde(P4,{Graph:()=>zs,alg:()=>u_,json:()=>F4,version:()=>Cde});var Tde=Object.defineProperty,B4=(e,t)=>{for(var n in t)Tde(e,n,{get:t[n],enumerable:!0})},zs=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,i])=>{e(s)&&t.setNode(s,i)}),Object.values(this._edgeObjs).forEach(s=>{t.hasNode(s.v)&&t.hasNode(s.w)&&t.setEdge(s,this.edge(s))});let n={},r=s=>{let i=this.parent(s);return!i||t.hasNode(i)?(n[s]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(s=>t.setParent(s,r(s))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let s,i,a,o,c=!1;typeof e=="object"&&e!==null&&"v"in e?(s=e.v,i=e.w,a=e.name,arguments.length===2&&(o=t,c=!0)):(s=e,i=t,a=r,arguments.length>2&&(o=n,c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);let u=hd(this._isDirected,s,i,a);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=o),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[u]=c?o:this._defaultEdgeLabelFn(s,i,a);let d=Ade(this._isDirected,s,i,a);return s=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,HA(this._preds[i],s),HA(this._sucs[s],i),this._in[i][u]=d,this._out[s][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):hd(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?xb(this._isDirected,e):hd(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?xb(this._isDirected,e):hd(this._isDirected,e,t,n),s=this._edgeObjs[r];if(s){let i=s.v,a=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],zA(this._preds[a],i),zA(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(s=>s.v===t&&s.w===n||s.v===n&&s.w===t):r}};function HA(e,t){e[t]?e[t]++:e[t]=1}function zA(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function hd(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let a=s;s=i,i=a}return s+""+i+""+(r===void 0?"\0":r)}function Ade(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let o=s;s=i,i=o}let a={v:s,w:i};return r&&(a.name=r),a}function xb(e,t){return hd(e,t.v,t.w,t.name)}var Cde="4.0.1",F4={};B4(F4,{read:()=>Lde,write:()=>Ide});function Ide(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Rde(e),edges:Ode(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Rde(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),r!==void 0&&(s.parent=r),s})}function Ode(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Lde(e){let t=new zs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var u_={};B4(u_,{CycleException:()=>pg,bellmanFord:()=>U4,components:()=>Dde,dijkstra:()=>hg,dijkstraAll:()=>Fde,findCycles:()=>Ude,floydWarshall:()=>Hde,isAcyclic:()=>Vde,postorder:()=>Yde,preorder:()=>Gde,prim:()=>Wde,shortestPaths:()=>qde,tarjan:()=>H4,topsort:()=>z4});var Mde=()=>1;function U4(e,t,n,r){return jde(e,String(t),n||Mde,r||function(s){return e.outEdges(s)})}function jde(e,t,n,r){let s={},i,a=0,o=e.nodes(),c=function(f){let h=n(f);s[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let s=this._arr,i=s.length;return n[r]=i,s.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,s=e;n>1,!(t[r].priority1;function hg(e,t,n,r){let s=function(i){return e.outEdges(i)};return Bde(e,String(t),n||Pde,r||s)}function Bde(e,t,n,r){let s={},i=new $4,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=s[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=i.removeMin(),o=s[a],o.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return s}function Fde(e,t,n){return e.nodes().reduce(function(r,s){return r[s]=hg(e,s,t,n),r},{})}function H4(e){let t=0,n=[],r={},s=[];function i(a){let o=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(o.lowlink=Math.min(o.lowlink,r[c].index)):(i(c),o.lowlink=Math.min(o.lowlink,r[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in r||i(a)}),s}function Ude(e){return H4(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var $de=()=>1;function Hde(e,t,n){return zde(e,t||$de,n||function(r){return e.outEdges(r)})}function zde(e,t,n){let r={},s=e.nodes();return s.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},s.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let o=a.v===i?a.w:a.v,c=t(a);r[i][o]={distance:c,predecessor:i}})}),s.forEach(function(i){let a=r[i];s.forEach(function(o){let c=r[o];s.forEach(function(u){let d=c[i],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);s=V4(e,o,n==="post",a,i,r,s)}),s}function V4(e,t,n,r,s,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),s(t).forEach(function(o){a=V4(e,o,n,r,s,i,a)}),n&&(a=i(a,t))),a}function K4(e,t,n){return Kde(e,t,n,function(r,s){return r.push(s),r},[])}function Yde(e,t){return K4(e,t,"post")}function Gde(e,t){return K4(e,t,"pre")}function Wde(e,t){let n=new zs,r={},s=new $4,i;function a(c){let u=c.v===i?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(i=s.removeMin(),i in r)n.setEdge(i,r[i]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(i).forEach(a)}return n}function qde(e,t,n,r){return Xde(e,t,n,r??(s=>{let i=e.outEdges(s);return i??[]}))}function Xde(e,t,n,r){if(n===void 0)return hg(e,t,n,r);let s=!1,i=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+s.weight,minlen:Math.max(r.minlen,s.minlen)})}),t}function Y4(e){let t=new zs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function VA(e,t){let n=e.x,r=e.y,s=t.x-n,i=t.y-r,a=e.width/2,o=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),c=o*s/i,u=o):(s<0&&(a=-a),c=a,u=a*i/s),{x:n+c,y:r+u}}function dh(e){let t=jf(W4(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),s=r.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][r.order]=n)}),t}function Zde(e){let t=e.nodes().map(r=>{let s=e.node(r).rank;return s===void 0?Number.MAX_VALUE:s}),n=Ii(Math.min,t);e.nodes().forEach(r=>{let s=e.node(r);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function Jde(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Ii(Math.min,t),r=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;r[o]||(r[o]=[]),r[o].push(a)});let s=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,o)=>{a===void 0&&o%i!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function KA(e,t,n,r){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=r),yu(e,"border",s,t)}function efe(e,t=G4){let n=[];for(let r=0;rG4){let n=efe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function W4(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Ii(Math.max,t)}function tfe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function q4(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function X4(e,t){return t()}var nfe=0;function d_(e){let t=++nfe;return e+(""+t)}function jf(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]:n=t,Object.entries(e).reduce((r,[s,i])=>(r[s]=n(i,s),r),{})}function rfe(e,t){return e.reduce((n,r,s)=>(n[r]=t[s],n),{})}var C0="\0",sfe="3.0.0",ife=class{constructor(){Sde(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return YA(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&YA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,afe)),n=n._prev;return"["+e.join(", ")+"]"}};function YA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function afe(e,t){if(e!=="_next"&&e!=="_prev")return t}var ofe=ife,lfe=()=>1;function cfe(e,t){if(e.nodeCount()<=1)return[];let n=dfe(e,t||lfe);return ufe(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function ufe(e,t,n){var r;let s=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)wb(e,t,n,o);for(;o=i.dequeue();)wb(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(r=t[c])==null?void 0:r.dequeue(),o){s=s.concat(wb(e,t,n,o,!0)||[]);break}}}return s}function wb(e,t,n,r,s){let i=[],a=s?i:void 0;return(e.inEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);s&&i.push({v:o.v,w:o.w}),u.out-=c,tx(t,n,u)}),(e.outEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,tx(t,n,d)}),e.removeNode(r.v),a}function dfe(e,t){let n=new zs,r=0,s=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);s=Math.max(s,f.out+=u),r=Math.max(r,h.in+=u)});let i=ffe(s+r+3).map(()=>new ofe),a=r+1;return n.nodes().forEach(o=>{tx(i,a,n.node(o))}),{graph:n,buckets:i,zeroIdx:a}}function tx(e,t,n){var r,s,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(r=e[0])==null||r.enqueue(n)}function ffe(e){let t=[];for(let n=0;n{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,d_("rev"))});function t(n){return r=>n.edge(r).weight}}function pfe(e){let t=[],n={},r={};function s(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[i])}return e.nodes().forEach(s),t}function mfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function gfe(e){e.graph().dummyChains=[],e.edges().forEach(t=>yfe(e,t))}function yfe(e,t){let n=t.v,r=e.node(n).rank,s=t.w,i=e.node(s).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,s;for(e.setEdge(n.edgeObj,r);n.dummy;)s=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=s,n=e.node(t)})}function f_(e){let t={};function n(r){let s=e.node(r);if(Object.hasOwn(t,r))return s.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=Ii(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}e.sources().forEach(n)}function tu(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Q4=Efe;function Efe(e){let t=new zs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],s=e.nodeCount();t.setNode(r,{});let i,a;for(;xfe(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!tu(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function wfe(e,t){return t.edges().reduce((n,r)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(s=tu(t,r)),st.node(r).rank+=n)}var{preorder:_fe,postorder:kfe}=u_,Nfe=bl;bl.initLowLimValues=p_;bl.initCutValues=h_;bl.calcCutValue=Z4;bl.leaveEdge=e6;bl.enterEdge=t6;bl.exchangeEdges=n6;function bl(e){e=Qde(e),f_(e);let t=Q4(e);p_(t),h_(t,e);let n,r;for(;n=e6(t);)r=t6(t,e,n),n6(t,e,n,r)}function h_(e,t){let n=kfe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Sfe(e,t,r))}function Sfe(e,t,n){let r=e.node(n).parent,s=e.edge(n,r);s.cutvalue=Z4(e,t,n)}function Z4(e,t,n){let r=e.node(n).parent,s=!0,i=t.edge(n,r),a=0;i||(s=!1,i=t.edge(r,n)),a=i.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,Afe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function p_(e,t){arguments.length<2&&(t=e.nodes()[0]),J4(e,{},1,t)}function J4(e,t,n,r,s){let i=n,a=e.node(r);t[r]=!0;let o=e.neighbors(r);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=J4(e,t,n,c,r))}),a.low=i,a.lim=n++,s?a.parent=s:delete a.parent,n}function e6(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function t6(e,t,n){let r=n.v,s=n.w;t.hasEdge(r,s)||(r=n.w,s=n.v);let i=e.node(r),a=e.node(s),o=i,c=!1;return i.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===GA(e,e.node(u.v),o)&&c!==GA(e,e.node(u.w),o)).reduce((u,d)=>tu(t,d)!e.node(s).parent);if(!n)return;let r=_fe(e,[n]);r=r.slice(1),r.forEach(s=>{let i=e.node(s).parent,a=t.edge(s,i),o=!1;a||(a=t.edge(i,s),o=!0),t.node(s).rank=t.node(i).rank+(o?a.minlen:-a.minlen)})}function Afe(e,t,n){return e.hasEdge(t,n)}function GA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Cfe=Ife;function Ife(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":WA(e);break;case"tight-tree":Ofe(e);break;case"longest-path":Rfe(e);break;case"none":break;default:WA(e)}}var Rfe=f_;function Ofe(e){f_(e),Q4(e)}function WA(e){Nfe(e)}var Lfe=Mfe;function Mfe(e){let t=Dfe(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),s=r.edgeObj,i=jfe(e,t,s.v,s.w),a=i.path,o=i.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(r=e.node(n),d){for(;(u=a[c])!==o&&e.node(u).maxRanka||o>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:s.concat(i.reverse()),lca:u}}function Dfe(e){let t={},n=0;function r(s){let i=n;e.children(s).forEach(r),t[s]={low:i,lim:n++}}return e.children(C0).forEach(r),t}function Pfe(e){let t=yu(e,"root",{},"_root"),n=Bfe(e),r=Object.values(n),s=Ii(Math.max,r)-1,i=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(o=>e.edge(o).minlen*=i);let a=Ffe(e)+1;e.children(C0).forEach(o=>r6(e,t,i,a,s,n,o)),e.graph().nodeRankFactor=i}function r6(e,t,n,r,s,i,a){var o;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=KA(e,"_bt"),d=KA(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;r6(e,t,n,r,s,i,h);let m=e.node(h),g=m.borderTop?m.borderTop:h,x=m.borderBottom?m.borderBottom:h,y=m.borderTop?r:2*r,w=g!==x?1:s-((p=i[a])!=null?p:0)+1;e.setEdge(u,g,{weight:y,minlen:w,nestingEdge:!0}),e.setEdge(x,d,{weight:y,minlen:w,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:s+((o=i[a])!=null?o:0)})}function Bfe(e){let t={};function n(r,s){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,s+1)),t[r]=s}return e.children(C0).forEach(r=>n(r,1)),t}function Ffe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Ufe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var $fe=Hfe;function Hfe(e){function t(n){let r=e.children(n),s=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let i=s.minRank,a=s.maxRank+1;iXA(e.node(t))),e.edges().forEach(t=>XA(e.edge(t)))}function XA(e){let t=e.width;e.width=e.height,e.height=t}function Kfe(e){e.nodes().forEach(t=>vb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(vb),Object.hasOwn(r,"y")&&vb(r)})}function vb(e){e.y=-e.y}function Yfe(e){e.nodes().forEach(t=>_b(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(_b),Object.hasOwn(r,"x")&&_b(r)})}function _b(e){let t=e.x;e.x=e.y,e.y=t}function Gfe(e){let t={},n=e.nodes().filter(o=>!e.children(o).length),r=n.map(o=>e.node(o).rank),s=Ii(Math.max,r),i=jf(s+1).map(()=>[]);function a(o){if(t[o])return;t[o]=!0;let c=e.node(o);i[c.rank].push(o);let u=e.successors(o);u&&u.forEach(a)}return n.sort((o,c)=>e.node(o).rank-e.node(c).rank).forEach(a),i}function Wfe(e,t){let n=0;for(let r=1;rd)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),i=1;for(;i{let d=u.pos+i;o[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=o[d+1]),d=d-1>>1,o[d]+=u.weight;c+=u.weight*f}),c}function Xfe(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let s=r.reduce((i,a)=>{let o=e.edge(a),c=e.node(a.v);return{sum:i.sum+o.weight*c.order,weight:i.weight+o.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function Qfe(e,t){let n={};e.forEach((s,i)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let i=n[s.v],a=n[s.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(s=>!s.indegree);return Zfe(r)}function Zfe(e){let t=[];function n(s){return i=>{i.merged||(i.barycenter===void 0||s.barycenter===void 0||i.barycenter>=s.barycenter)&&Jfe(s,i)}}function r(s){return i=>{i.in.push(s),--i.indegree===0&&e.push(i)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(r(s))}return t.filter(s=>!s.merged).map(s=>mg(s,["vs","i","barycenter","weight"]))}function Jfe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ehe(e,t){let n=tfe(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),i=[],a=0,o=0,c=0;r.sort(the(!!t)),c=QA(i,s,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),a+=d.barycenter*d.weight,o+=d.weight,c=QA(i,s,c)});let u={vs:i.flat(1)};return o&&(u.barycenter=a/o,u.weight=o),u}function QA(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function the(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function i6(e,t,n,r){let s=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,o=i?i.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==o));let u=Xfe(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=i6(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&rhe(h,p)}});let d=Qfe(u,n);nhe(d,c);let f=ehe(d,r);if(a&&o){f.vs=[a,f.vs,o].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(o),g=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function nhe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function rhe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function she(e,t,n,r){r||(r=e.nodes());let s=ihe(e),i=new zs({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let o=e.node(a),c=e.parent(a);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){i.setNode(a),i.setParent(a,c||s);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=i.edge(f,a),p=h!==void 0?h.weight:0;i.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),i}function ihe(e){let t;for(;e.hasNode(t=d_("_root")););return t}function ahe(e,t,n){let r={},s;n.forEach(i=>{let a=e.parent(i),o,c;for(;a;){if(o=e.parent(a),o?(c=r[o],r[o]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=o}})}function a6(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,a6);return}let n=W4(e),r=ZA(e,jf(1,n+1),"inEdges"),s=ZA(e,jf(n-1,-1,-1),"outEdges"),i=Gfe(e);if(JA(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,o,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){ohe(u%2?r:s,u%4>=2,c),i=dh(e);let f=Wfe(e,i);f{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&s(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let o=a.minRank;o<=a.maxRank;o++)o!==a.rank&&s(o,i)}return t.map(function(i){return she(e,i,n,r.get(i)||[])})}function ohe(e,t,n){let r=new zs;e.forEach(function(s){n.forEach(o=>r.setEdge(o.left,o.right));let i=s.graph().root,a=i6(s,i,r,t);a.vs.forEach((o,c)=>s.node(o).order=c),ahe(s,r,a.vs)})}function JA(e,t){Object.values(t).forEach(n=>n.forEach((r,s)=>e.node(r).order=s))}function lhe(e,t){let n={};function r(s,i){let a=0,o=0,c=s.length,u=i[i.length-1];return i.forEach((d,f)=>{let h=uhe(e,d),p=h?e.node(h).order:c;(h||d===u)&&(i.slice(o,f+1).forEach(m=>{let g=e.predecessors(m);g&&g.forEach(x=>{let y=e.node(x),w=y.order;(w{let f=i[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&o6(n,p,f)})}})}function s(i,a){let o=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,r(a,u,f,o,c),u=f,o=c}}r(a,u,a.length,c,i.length)}),a}return t.length&&t.reduce(s),n}function uhe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function o6(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];r||(e[t]=r={}),r[n]=!0}function dhe(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function fhe(e,t,n,r){let s={},i={},a={};return t.forEach(o=>{o.forEach((c,u)=>{s[c]=c,i[c]=c,a[c]=u})}),t.forEach(o=>{let c=-1;o.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((p,m)=>{let g=a[p],x=a[m];return(g!==void 0?g:0)-(x!==void 0?x:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let g=f[p];if(g===void 0)continue;let x=a[g];if(x!==void 0&&i[u]===u&&c{var y;let w=(y=i[x.v])!=null?y:0,b=a.edge(x);return Math.max(g,w+(b!==void 0?b:0))},0):i[p]=0}function d(p){let m=a.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=m.reduce((y,w)=>{let b=i[w.w],_=a.edge(w);return Math.min(y,(b!==void 0?b:0)-(_!==void 0?_:0))},Number.POSITIVE_INFINITY));let x=e.node(p);g!==Number.POSITIVE_INFINITY&&x.borderType!==o&&(i[p]=Math.max(i[p]!==void 0?i[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var m;let g=n[p];g!==void 0&&(i[p]=(m=i[g])!=null?m:0)}),i}function phe(e,t,n,r){let s=new zs,i=e.graph(),a=Ehe(i.nodesep,i.edgesep,r);return t.forEach(o=>{let c;o.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function mhe(e,t){return Object.values(t).reduce((n,r)=>{let s=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([o,c])=>{let u=xhe(e,o)/2;s=Math.max(c+u,s),i=Math.min(c-u,i)});let a=s-i;return a{["l","r"].forEach(a=>{let o=i+a,c=e[o];if(!c||c===t)return;let u=Object.values(c),d=r-Ii(Math.min,u);a!=="l"&&(d=s-Ii(Math.max,u)),d&&(e[o]=A0(c,f=>f+d))})})}function yhe(e,t=void 0){let n=e.ul;return n?A0(n,(r,s)=>{var i,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let o=Object.values(e).map(c=>{let u=c[s];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=o[1])!=null?i:0)+((a=o[2])!=null?a:0))/2}):{}}function bhe(e){let t=dh(e),n=Object.assign(lhe(e,t),che(e,t)),r={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(o=>{o==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=fhe(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=hhe(e,s,c.root,c.align,o==="r");o==="r"&&(u=A0(u,d=>-d)),r[a+o]=u})});let i=mhe(e,r);return ghe(r,i),yhe(r,e.graph().align)}function Ehe(e,t,n){return(r,s,i)=>{let a=r.node(s),o=r.node(i),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(o.dummy?t:e)/2,c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(c+=n?u:-u),c}}function xhe(e,t){return e.node(t).width}function whe(e){e=Y4(e),vhe(e),Object.entries(bhe(e)).forEach(([t,n])=>e.node(t).x=n)}function vhe(e){let t=dh(e),n=e.graph(),r=n.ranksep,s=n.rankalign,i=0;t.forEach(a=>{let o=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);s==="top"?u.y=i+u.height/2:s==="bottom"?u.y=i+o-u.height/2:u.y=i+o/2}),i+=o+r})}function _he(e,t={}){let n=t.debugTiming?q4:X4;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Lhe(e));return n(" runLayout",()=>khe(r,n,t)),n(" updateInputGraph",()=>Nhe(e,r)),r})}function khe(e,t,n){t(" makeSpaceForEdgeLabels",()=>Mhe(e)),t(" removeSelfEdges",()=>zhe(e)),t(" acyclic",()=>hfe(e)),t(" nestingGraph.run",()=>Pfe(e)),t(" rank",()=>Cfe(Y4(e))),t(" injectEdgeLabelProxies",()=>jhe(e)),t(" removeEmptyRanks",()=>Jde(e)),t(" nestingGraph.cleanup",()=>Ufe(e)),t(" normalizeRanks",()=>Zde(e)),t(" assignRankMinMax",()=>Dhe(e)),t(" removeEdgeLabelProxies",()=>Phe(e)),t(" normalize.run",()=>gfe(e)),t(" parentDummyChains",()=>Lfe(e)),t(" addBorderSegments",()=>$fe(e)),t(" order",()=>a6(e,n)),t(" insertSelfEdges",()=>Vhe(e)),t(" adjustCoordinateSystem",()=>zfe(e)),t(" position",()=>whe(e)),t(" positionSelfEdges",()=>Khe(e)),t(" removeBorderNodes",()=>Hhe(e)),t(" normalize.undo",()=>bfe(e)),t(" fixupEdgeLabelCoords",()=>Uhe(e)),t(" undoCoordinateSystem",()=>Vfe(e)),t(" translateGraph",()=>Bhe(e)),t(" assignNodeIntersects",()=>Fhe(e)),t(" reversePoints",()=>$he(e)),t(" acyclic.undo",()=>mfe(e))}function Nhe(e,t){e.nodes().forEach(n=>{let r=e.node(n),s=t.node(n);r&&(r.x=s.x,r.y=s.y,r.order=s.order,r.rank=s.rank,t.children(n).length&&(r.width=s.width,r.height=s.height))}),e.edges().forEach(n=>{let r=e.edge(n),s=t.edge(n);r.points=s.points,Object.hasOwn(s,"x")&&(r.x=s.x,r.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var She=["nodesep","edgesep","ranksep","marginx","marginy"],The={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Ahe=["acyclicer","ranker","rankdir","align","rankalign"],Che=["width","height","rank"],eC={width:0,height:0},Ihe=["minlen","weight","width","height","labeloffset"],Rhe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ohe=["labelpos"];function Lhe(e){let t=new zs({multigraph:!0,compound:!0}),n=Nb(e.graph());return t.setGraph(Object.assign({},The,kb(n,She),mg(n,Ahe))),e.nodes().forEach(r=>{let s=Nb(e.node(r)),i=kb(s,Che);Object.keys(eC).forEach(o=>{i[o]===void 0&&(i[o]=eC[o])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let s=Nb(e.edge(r));t.setEdge(r,Object.assign({},Rhe,kb(s,Ihe),mg(s,Ohe)))}),t}function Mhe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function jhe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),s={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};yu(e,"edge-proxy",s,"_ep")}})}function Dhe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Phe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Bhe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,s=0,i=e.graph(),a=i.marginx||0,o=i.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),s=Math.max(s,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=o,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+a,i.height=s-r+o}function Fhe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),s=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=s,a=r),n.points.unshift(VA(r,i)),n.points.push(VA(s,a))})}function Uhe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function $he(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Hhe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),s=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(s.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function zhe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Vhe(e){dh(e).forEach(t=>{let n=0;t.forEach((r,s)=>{let i=e.node(r);i.order=s+n,(i.selfEdges||[]).forEach(a=>{yu(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Khe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,s=e.node(r.e.v),i=s.x+s.width/2,a=s.y,o=n.x-i,c=s.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-c},{x:i+5*o/6,y:a-c},{x:i+o,y:a},{x:i+5*o/6,y:a+c},{x:i+2*o/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function kb(e,t){return A0(mg(e,t),Number)}function Nb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Yhe(e){let t=dh(e),n=new zs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,s)=>{let i="layer"+s;n.setNode(i,{rank:"same"}),r.reduce((a,o)=>(n.setEdge(a,o,{style:"invis"}),o))}),n}var Ghe={graphlib:P4,version:sfe,layout:_he,debug:Yhe,util:{time:q4,notime:X4}},tC=Ghe;/*! For license information please see dagre.esm.js.LEGAL.txt */const pd={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:tl},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:sM},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:GL},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:nv},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:Xg}},nx=220,rx=88,nC=96,rC=34,gg=64,sC=310,ic=24,l6=56,sx=40,iC=40,Whe=18,qhe=58,Xhe=!1,Qhe=e=>e==="sequential"||e==="parallel"||e==="loop";function ix(e,t){const n=e.agentType??"llm";return Qhe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function ax(e,t=[],n="horizontal"){const r=e.agentType??"llm";if(!ix(e,t))return{width:nx,height:rx};const s=e.subAgents.map((d,f)=>ax(d,[...t,f],n)),i=s.length?Math.max(...s.map(d=>d.width)):0,a=s.length?Math.max(...s.map(d=>d.height)):0,o=s.length&&r!=="parallel"?l6:ic,c=n==="horizontal"?r!=="parallel":r==="parallel",u=s.length?r==="parallel"?Whe+iC:r==="loop"?qhe:0:iC;return c?{width:Math.max(sC,s.reduce((d,f)=>d+f.width,0)+sx*Math.max(0,s.length-1)+o*2),height:gg+ic+a+u+ic}:{width:Math.max(sC,i+ic*2),height:gg+o+s.reduce((d,f)=>d+f.height,0)+sx*Math.max(0,s.length-1)+u+o}}function Xu(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function Zhe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function aC(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Qu(e,t,n,r){const s=(r==null?void 0:r.tone)==="sequential"?"hsl(213 40% 40%)":(r==null?void 0:r.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${r!=null&&r.loop?"-loop":""}`,source:e,target:t,sourceHandle:r!=null&&r.loop?"loop-source":void 0,targetHandle:r!=null&&r.loop?"loop-target":void 0,label:n,type:"insertStep",data:r?{insert:r.insert,loop:r.loop,tone:r.tone}:void 0,animated:r==null?void 0:r.loop,markerEnd:{type:qc.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function oC(e,t){const n=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],r=[];function s(u,d,f,h,p){const m=u.agentType??"llm",g=Xu(d);return ix(u,d)?(i(u,d,f,h,p),g):(n.push({id:g,type:"agent",parentId:f,extent:"parent",position:h,data:{kind:"agent",path:d,agent:u,title:m==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:m,description:u.description.trim()||pd[m].description,childCount:u.subAgents.length,containedIn:p}}),g)}function i(u,d,f,h={x:0,y:0},p){const m=u.agentType??"sequential",g=Xu(d),x=ax(u,d,t);n.push({id:g,type:"group",parentId:f,extent:f?"parent":void 0,position:h,style:{width:x.width,height:x.height},data:{kind:"agent",path:d,agent:u,title:u.name.trim()||(d.length===0?"主 Agent":pd[m].label),pattern:m,description:u.description.trim()||pd[m].description,childCount:u.subAgents.length,containedIn:p,layoutWidth:x.width,layoutHeight:x.height}});const y=u.subAgents.map((N,A)=>ax(N,[...d,A],t)),w=y.length&&m!=="parallel"?l6:ic,b=t==="horizontal"?m!=="parallel":m==="parallel";let _=w;const k=u.subAgents.map((N,A)=>{const S=y[A],C=b?{x:_,y:gg+ic}:{x:(x.width-S.width)/2,y:gg+_};return _+=(b?S.width:S.height)+sx,s(N,[...d,A],g,C,m)});if(m==="sequential"||m==="loop"){for(let N=0;N1&&r.push(Qu(k[k.length-1],k[0],"继续循环",{loop:!0,tone:"loop"}))}return g}const a=(u,d)=>{const f=u.agentType??"llm",h=Xu(d);if(ix(u,d))return i(u,d),[h];if(n.push({id:h,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:d,agent:u,title:f==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:f,description:u.description.trim()||pd[f].description,childCount:u.subAgents.length}}),u.subAgents.length===0)return[h];const p=[];return u.subAgents.forEach((m,g)=>{const x=[...d,g],y=Xu(x);r.push(Qu(h,y,"调用",{insert:{parentPath:d,index:g}})),p.push(...a(m,x))}),p},o=Xu([]),c=a(e,[]);return r.push(Qu("terminal-input",o)),c.forEach(u=>r.push(Qu(u,"terminal-output"))),Jhe(n,r,t)}function Jhe(e,t,n){const r=new tC.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=new Set(e.filter(i=>!i.parentId).map(i=>i.id));return e.filter(i=>!i.parentId).forEach(i=>{const a=i.data.kind==="terminal";r.setNode(i.id,{width:a?nC:i.data.layoutWidth??nx,height:a?rC:i.data.layoutHeight??rx})}),t.filter(i=>s.has(i.source)&&s.has(i.target)).forEach(i=>r.setEdge(i.source,i.target)),tC.layout(r),{nodes:e.map(i=>{if(i.parentId)return i;const a=r.node(i.id),o=i.data.kind==="terminal",c=o?nC:i.data.layoutWidth??nx,u=o?rC:i.data.layoutHeight??rx;return{...i,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const I0=E.createContext(null),R0=E.createContext("horizontal");function epe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,markerEnd:o,style:c,label:u,data:d}){const f=E.useContext(I0),[h,p]=E.useState(!1),[m,g,x]=dg({sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,offset:d!=null&&d.loop?28:20});return l.jsxs(l.Fragment,{children:[l.jsx(uh,{id:e,path:m,markerEnd:o,style:c}),f&&(d==null?void 0:d.insert)&&l.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&l.jsx(que,{children:l.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}px, ${x}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&l.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&l.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:l.jsx(ir,{})})]})})]})}function tpe({data:e,selected:t}){const n=E.useContext(I0),r=E.useContext(R0),s=r==="vertical"?Ue.Top:Ue.Left,i=r==="vertical"?Ue.Bottom:Ue.Right,a=r==="vertical"?Ue.Right:Ue.Bottom,o=e.pattern??"llm",c=pd[o],u=c.icon;return l.jsxs("div",{className:`abc-node is-${o}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[l.jsx(kr,{type:"target",position:s,className:"abc-handle"}),o!=="llm"&&l.jsx("span",{className:"abc-node-icon",children:l.jsx(u,{})}),l.jsxs("span",{className:"abc-node-copy",children:[l.jsx("span",{className:"abc-node-meta",children:l.jsx("span",{children:c.label})}),l.jsx("strong",{children:e.title}),l.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(js,{})}),l.jsx(kr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(kr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function npe({data:e,selected:t}){const n=E.useContext(I0),r=E.useContext(R0),s=r==="vertical"?Ue.Top:Ue.Left,i=r==="vertical"?Ue.Bottom:Ue.Right,a=r==="vertical"?Ue.Right:Ue.Bottom,o=e.pattern??"sequential",c=e.childCount??0,u=o==="llm"?"添加子 Agent":o==="parallel"?"添加一个同时处理的步骤":o==="loop"?"添加循环步骤":"添加下一个步骤";return l.jsxs("div",{className:`abc-group is-${o}${t?" is-selected":""}`,children:[l.jsx(kr,{type:"target",position:s,className:"abc-handle"}),l.jsx("header",{className:"abc-group-head",children:l.jsxs("span",{children:[l.jsx("strong",{title:e.title,children:e.title}),l.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&o!=="parallel"&&l.jsxs("div",{className:"abc-group-boundary-actions",children:[l.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:l.jsx(ir,{})}),l.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:l.jsx(ir,{})})]}),n&&e.path!==void 0&&c>0&&o==="parallel"&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(ir,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(ir,{}),l.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(js,{})}),l.jsx(kr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(kr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function rpe({data:e}){const t=E.useContext(R0);return l.jsxs("div",{className:"abc-terminal",children:[l.jsx(kr,{type:"target",position:t==="vertical"?Ue.Top:Ue.Left,className:"abc-handle"}),l.jsx("span",{children:e.title}),l.jsx(kr,{type:"source",position:t==="vertical"?Ue.Bottom:Ue.Right,className:"abc-handle"})]})}const spe={agent:tpe,group:npe,terminal:rpe},ipe={insertStep:epe};function ape({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:s,onDelete:i,readOnly:a=!1,interactivePreview:o=!1,direction:c="horizontal"}){const u=E.useMemo(()=>oC(e,c),[]),[d,f,h]=C4(u.nodes),[p,m,g]=I4(u.edges),x=Que(),y=E.useRef(`${c}:${aC(e)}`),w=E.useRef(null),{fitView:b}=S0(),_=E.useMemo(()=>oC(e,c),[c,e]),[k,N]=E.useState(()=>window.matchMedia("(max-width: 860px)").matches),A=E.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,a]),S=E.useCallback(()=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>void b(A))})},[A,b]);E.useEffect(()=>{const R=window.matchMedia("(max-width: 860px)"),O=F=>N(F.matches);return R.addEventListener("change",O),()=>R.removeEventListener("change",O)},[]),E.useEffect(()=>{const R=`${c}:${aC(e)}`,O=R!==y.current;y.current=R,m(_.edges),f(F=>{const q=new Map(F.map(L=>[L.id,L.position]));return _.nodes.map(L=>({...L,position:!O&&q.get(L.id)?q.get(L.id):L.position,selected:L.data.kind==="agent"&&!!L.data.path&&Zhe(L.data.path,t)}))}),O&&S()},[_,e,S,t,m,f]),E.useEffect(()=>{S()},[k,S]),E.useEffect(()=>{x&&S()},[_,S,x]),E.useEffect(()=>{if(!a||!w.current)return;const R=new ResizeObserver(()=>S());return R.observe(w.current),S(),()=>R.disconnect()},[S,a]);const C=E.useMemo(()=>a?null:{onAdd:r,onInsert:s,onDelete:i},[r,i,s,a]);return l.jsx(R0.Provider,{value:c,children:l.jsx(I0.Provider,{value:C,children:l.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:l.jsx("div",{ref:w,className:"abc-canvas",children:l.jsxs(A4,{nodes:d,edges:p,nodeTypes:spe,edgeTypes:ipe,onNodesChange:h,onEdgesChange:g,onNodeClick:(R,O)=>{!a&&O.data.kind==="agent"&&O.data.path&&n(O.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||o,zoomOnDoubleClick:o,zoomOnPinch:!a||o,zoomOnScroll:!a||o,fitView:!0,fitViewOptions:A,minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[l.jsx(O4,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||o)&&l.jsx(M4,{showInteractive:!1}),Xhe]})})})})})}function yg(e){return l.jsx(c_,{children:l.jsx(ape,{...e})})}const ope="doubao-seed-2-1-pro-260628",lpe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",cpe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function jr(){return{name:"",description:ope,instruction:lpe,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:ape,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:Fc,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const cpe=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率"}],upe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],dpe=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"}];function c6(e){const t=e.tools??[],n=rl.filter(s=>s.toolNames.some(i=>t.includes(i))),r=new Set(n.flatMap(s=>s.toolNames));return{...jr(),name:e.name,description:e.description,instruction:e.instruction||jr().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!r.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(c6)}}function fpe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?c6(e.graph):{...jr(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(r=>r.name))??[]}}function u6(e){return e?1+e.children.reduce((t,n)=>t+u6(n),0):1}function ox(e){return 1+e.subAgents.reduce((t,n)=>t+ox(n),0)}function lx(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function hpe(e){const t=lx(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function ppe(e,t){return e.find(n=>n.kind===t)}const cx=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}];function mpe(e){if(e.status==="success")return cx.length-1;const t=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",部署完成:"complete"}[e.label],n=cx.findIndex(r=>r.phase===t);return n<0?0:n}function gpe({task:e}){const t=mpe(e),n=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),r=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return l.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[l.jsxs("div",{className:"aw-deploy-progress-head",children:[l.jsxs("div",{children:[l.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?l.jsx(Kt,{className:"spin"}):e.status==="success"?l.jsx(QL,{}):e.status==="error"?l.jsx(qg,{}):l.jsx(cE,{})}),l.jsxs("div",{children:[l.jsx("h3",{children:r}),l.jsx("p",{children:e.runtimeName})]})]}),l.jsx("strong",{children:e.status==="running"?`${Math.round(n)}%`:e.label})]}),l.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),children:l.jsx("span",{style:{width:`${n}%`}})}),l.jsx("ol",{className:"aw-deploy-steps",children:cx.map((s,i)=>{const a=e.status==="success"||inew Set),[gt,At]=E.useState(()=>new Set),[ut,X]=E.useState(!1),[ne,he]=E.useState(""),[Te,He]=E.useState([]),[qe,Ut]=E.useState([]),[Ye,De]=E.useState(!1),[Be,Ct]=E.useState(""),[un,$t]=E.useState(0),[wn,Fe]=E.useState(!1),[dt,Lt]=E.useState(()=>new Set),[_t,be]=E.useState(!1),[Ve,st]=E.useState(""),[sn,an]=E.useState(""),[Ht,zt]=E.useState(()=>new Set),Bt=E.useRef(!1),qt=E.useRef(""),vn=E.useRef(null),[Xt,Ln]=E.useState(upe),[Mn,ue]=E.useState("");E.useEffect(()=>{e.length!==0&&Ln(z=>z.map((re,Ee)=>Ee===0&&re.agentIds.length===0?{...re,agentIds:e.slice(0,2).map($=>$.id)}:re))},[e]);const _e=E.useMemo(()=>{const z=new Map;for(const re of e)re.runtimeId&&z.set(re.runtimeId,re);return z},[e]),ve=E.useMemo(()=>{var re;const z=new Map;for(const Ee of t){const $=(re=Ee.deploymentTarget)==null?void 0:re.runtimeId;if(!$||!_e.has($))continue;const le=z.get($);(!le||Ee.updatedAt>le.updatedAt)&&z.set($,Ee)}return z},[_e,t]),ye=E.useMemo(()=>{const z=new Map;for(const re of d){if(!re.runtimeId)continue;const Ee=z.get(re.runtimeId);(!Ee||re.startedAt>Ee.startedAt)&&z.set(re.runtimeId,re)}return z},[d]),nt=E.useMemo(()=>{const z=ce.trim().toLowerCase();return z?e.filter(re=>{const Ee=re.runtimeId?ve.get(re.runtimeId):void 0,$=re.runtimeId?ye.get(re.runtimeId):void 0;return[re.label,re.app,re.host??"",(Ee==null?void 0:Ee.draft.name)??"",(Ee==null?void 0:Ee.draft.description)??"",($==null?void 0:$.runtimeName)??""].join(" ").toLowerCase().includes(z)}):e},[e,ye,ce,ve]),Qe=E.useMemo(()=>{const z=ce.trim().toLowerCase();return t.filter(re=>{var $;const Ee=($=re.deploymentTarget)==null?void 0:$.runtimeId;return Ee&&_e.has(Ee)?!1:z?`${re.draft.name} ${re.draft.description}`.toLowerCase().includes(z):!0})},[_e,t,ce]),ct=E.useMemo(()=>t.filter(z=>{var Ee;const re=(Ee=z.deploymentTarget)==null?void 0:Ee.runtimeId;return!re||!_e.has(re)}).length,[_e,t]),ot=E.useMemo(()=>{const z=ce.trim().toLowerCase();return z?Xt.filter(re=>re.name.toLowerCase().includes(z)):Xt},[Xt,ce]),oe=e.find(z=>z.id===D),Ze=t.find(z=>z.id===M),It=d.find(z=>z.id===U),it=oe!=null&&oe.runtimeId?ve.get(oe.runtimeId):void 0,kt=g?B:D&&s===D?r:null,Ft=E.useMemo(()=>{const z=new Map(e.map((Ee,$)=>[Ee.id,$])),re=new Map(n.map((Ee,$)=>[Ee,$]));return[...nt].sort((Ee,$)=>{const le=Ee.runtimeId?ye.get(Ee.runtimeId):void 0,Re=$.runtimeId?ye.get($.runtimeId):void 0,$e=(le==null?void 0:le.status)==="running"?le.startedAt:0,pt=(Re==null?void 0:Re.status)==="running"?Re.startedAt:0;if($e!==pt)return pt-$e;const at=re.get(Ee.id),lt=re.get($.id);return at!=null&<!=null?at-lt:at!=null?-1:lt!=null?1:(z.get(Ee.id)??0)-(z.get($.id)??0)})},[n,e,nt,ye]),Zn=(oe==null?void 0:oe.label)||(kt==null?void 0:kt.name)||(Ze==null?void 0:Ze.draft.name)||(It==null?void 0:It.runtimeName)||"未选择智能体",or=Xt.find(z=>z.id===Mn),lr=Ft.filter(z=>z.canDelete===!0),dn=Ft.filter(z=>Xe.has(z.id)&&z.canDelete===!0),Zt=Qe.filter(z=>gt.has(z.id)),Yt=lr.length+Qe.length,Jt=dn.length+Zt.length,Mt=E.useMemo(()=>(It==null?void 0:It.agentDraft)??(Ze==null?void 0:Ze.draft)??(it==null?void 0:it.draft)??fpe(kt,(oe==null?void 0:oe.label)??"agent"),[kt,oe==null?void 0:oe.label,it==null?void 0:it.draft,Ze==null?void 0:Ze.draft,It==null?void 0:It.agentDraft]),Cn=E.useMemo(()=>{if(kt)return kt.tools;const z=(Mt.builtinTools??[]).map(re=>{var Ee;return((Ee=rl.find($=>$.id===re))==null?void 0:Ee.label)??re});return Array.from(new Set([...Mt.tools,...z,...(Mt.customTools??[]).map(re=>re.name),...(Mt.mcpTools??[]).map(re=>re.name)].filter(Boolean)))},[Mt,kt]),fn=E.useMemo(()=>kt?kt.skillsPreviewSupported?kt.skills.map(z=>z.name):null:Array.from(new Set([...(Mt.selectedSkills??[]).map(z=>z.name),...Mt.skills].filter(Boolean))),[Mt,kt]),en=E.useMemo(()=>{if(It)return It;if(Ze)return d.filter(z=>{var re,Ee;return((re=z.agentDraft)==null?void 0:re.name)===Ze.draft.name||z.runtimeName===Ze.draft.name||!!((Ee=Ze.deploymentTarget)!=null&&Ee.runtimeId)&&z.runtimeId===Ze.deploymentTarget.runtimeId}).sort((z,re)=>re.startedAt-z.startedAt)[0];if(oe)return d.filter(z=>!!oe.runtimeId&&z.runtimeId===oe.runtimeId||z.runtimeName===oe.label).sort((z,re)=>re.startedAt-z.startedAt)[0]},[d,oe,Ze,It]),Vn=kt?`runtime:${(oe==null?void 0:oe.runtimeId)??kt.name}:${ox(Mt)}`:`draft:${(It==null?void 0:It.id)??(Ze==null?void 0:Ze.id)??(oe==null?void 0:oe.id)??Zn}`,hn=!!(g&&(oe!=null&&oe.runtimeId)&&!Q);E.useEffect(()=>{if(!f)return;const z=d.find(Ee=>Ee.id===f),re=z!=null&&z.runtimeId?_e.get(z.runtimeId):void 0;if(re){I(""),j(""),T(re.id),L("basic");return}T(""),j(""),I(f),L("basic")},[_e,d,f]),E.useEffect(()=>{if(!h){qt.current="";return}const z=`${h}:${p}:${m}`;qt.current!==z&&e.some(re=>re.id===h)&&(qt.current=z,I(""),j(""),T(h),L(p),p==="evaluations"&&(te(m),we("")))},[e,h,p,m]),E.useEffect(()=>{let z=!1;if(ie(null),ee(!g||!(oe!=null&&oe.runtimeId)),!(!g||!(oe!=null&&oe.runtimeId)))return e0(oe.runtimeId,oe.region??"cn-beijing").then(re=>{z||ie(re)}).catch(()=>{z||ie(null)}).finally(()=>{z||ee(!0)}),()=>{z=!0}},[g,oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{let z=!1;if(W(null),!!(oe!=null&&oe.runtimeId))return hv(oe.runtimeId,oe.region??"cn-beijing").then(re=>{z||W(re)}).catch(()=>{z||W(null)}),()=>{z=!0}},[oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{let z=!1;if(He([]),Ut([]),Ct(""),q!=="evaluations"||!(oe!=null&&oe.runtimeId)){De(!1);return}return De(!0),yM({runtimeId:oe.runtimeId,region:oe.region??"cn-beijing",appName:oe.app,pageSize:100}).then(re=>{z||(Ut(re.sets),He(re.items.map(Ee=>({...Ee,tag:Ee.kind==="good"?"Good case":"Bad case"})).sort((Ee,$)=>lx($.createdAt)-lx(Ee.createdAt))))}).catch(re=>{z||Ct(re instanceof Error?re.message:String(re))}).finally(()=>{z||De(!1)}),()=>{z=!0}},[un,q,oe==null?void 0:oe.app,oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{const z=new Set(Te.map(re=>re.id));Lt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee}),zt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee}),sn&&!z.has(sn)&&an("")},[Te,sn]),E.useEffect(()=>{Fe(!1),Lt(new Set),zt(new Set),st(""),an("")},[oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{const z=new Set(Ft.filter(re=>re.canDelete===!0).map(re=>re.id));xt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee})},[Ft]),E.useEffect(()=>{const z=new Set(Qe.map(re=>re.id));At(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee})},[Qe]);const gr=oe!=null&&oe.runtimeId?Te:cpe,Kn=gr.filter(z=>{if(z.kind!==fe)return!1;const re=ge.trim().toLowerCase();return re?[z.input,z.output,z.referenceOutput,z.comment,z.tag??"",z.sessionId,z.messageId,z.userId,z.evaluationSetName].join(" ").toLowerCase().includes(re):!0}),bs=Kn.filter(z=>dt.has(z.id)),yr=!!(oe!=null&&oe.runtimeId),es=z=>{te(z),we(""),st("");const re=gr.find(Ee=>Ee.kind===z);an((re==null?void 0:re.id)??""),window.setTimeout(()=>{var Ee;(Ee=vn.current)==null||Ee.scrollIntoView({behavior:"smooth",block:"start"})},0)},Es=z=>{st(""),Lt(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee})},bi=()=>{st(""),Lt(new Set(Kn.map(z=>z.id)))},po=()=>{st(""),Lt(new Set),Fe(!1)},xs=z=>{zt(re=>{const Ee=new Set(re);return Ee.has(z)?Ee.delete(z):Ee.add(z),Ee})},Ei=z=>{an(z.id),st(""),!(!z.sessionId||!z.messageId)&&(N==null||N(z))},$i=async z=>{if(!(oe!=null&&oe.runtimeId)||_t||z.length===0)return;const re=z.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${z.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(re))return;const Ee=z.map(le=>le.id),$=new Set(Ee);be(!0),st("");try{await bM({runtimeId:oe.runtimeId,region:oe.region??"cn-beijing",appName:oe.app,itemIds:Ee});const le=new Map;for(const Re of z)le.set(Re.kind,(le.get(Re.kind)??0)+1);He(Re=>Re.filter($e=>!$.has($e.id))),Ut(Re=>Re.map($e=>({...$e,itemCount:Math.max(0,$e.itemCount-(le.get($e.kind)??0))}))),Lt(Re=>new Set([...Re].filter($e=>!$.has($e)))),zt(Re=>new Set([...Re].filter($e=>!$.has($e)))),sn&&$.has(sn)&&an(""),z.length>1&&Fe(!1),A==null||A(z)}catch(le){st(le instanceof Error?le.message:String(le))}finally{be(!1)}},Ur=z=>{Ln(re=>re.map(Ee=>Ee.id===z.id?z:Ee))},Ar=()=>{const z=new Set(e.map($=>$.id)),re=n.filter($=>z.has($)),Ee=new Set(re);return[...re,...e.filter($=>!Ee.has($.id)).map($=>$.id)]},Jn=(z,re,Ee)=>{if(!y||z===re)return;const $=Ar().filter($e=>$e!==z),le=$.indexOf(re),Re=le<0?$.length:Ee==="after"?le+1:le;$.splice(Re,0,z),y($)},Ea=(z,re)=>{if(!Z||Z===re)return;const Ee=z.currentTarget.getBoundingClientRect();Ie(re),Ce(z.clientY>Ee.top+Ee.height/2?"after":"before")},Hi=(z,re)=>{if(!y)return;const Ee=Ar(),$=Ee.indexOf(z),le=Math.max(0,Math.min(Ee.length-1,$+re));$<0||$===le||(Ee.splice($,1),Ee.splice(le,0,z),y(Ee))},wl=z=>{z.canDelete===!0&&(he(""),xt(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee}))},vl=z=>{he(""),At(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee})},xa=()=>{he(""),xt(new Set(lr.map(z=>z.id))),At(new Set(Qe.map(z=>z.id)))},wa=()=>{he(""),xt(new Set),At(new Set),Ge(!1)},va=async()=>{if(Jt===0||ut)return;const z=dn.length,re=Zt.length,Ee=z===1&&re===0?`确定删除 Agent "${dn[0].label}"?该 Runtime 将被永久删除。`:z===0&&re===1?`确定删除草稿 "${Zt[0].draft.name||"未命名 Agent"}"?`:`确定删除选中的 ${Jt} 个项目?${z>0?`${z} 个 Runtime 将被永久删除。`:""}`;if(window.confirm(Ee)){X(!0),he("");try{if(dn.length>0){if(!w)throw new Error("当前页面不支持删除已部署 Agent。");await w(dn)}Zt.length>0&&(b==null||b(Zt)),xt(new Set),At(new Set),Ge(!1),dn.some($=>$.id===D)&&T(""),Zt.some($=>$.id===M)&&j("")}catch($){he($ instanceof Error?$.message:String($))}finally{X(!1)}}},mo=async z=>{if(!(!w||z.canDelete!==!0||ut)&&window.confirm(`确定删除 Agent "${z.label}"?该 Runtime 将被永久删除。`)){X(!0),he("");try{await w([z]),D===z.id&&T("")}catch(re){he(re instanceof Error?re.message:String(re))}finally{X(!1)}}},_a=z=>{if(!b||ut)return;const re=z.draft.name||"未命名 Agent";window.confirm(`确定删除草稿 "${re}"?`)&&(he(""),b([z]),M===z.id&&j(""))},Vs=()=>{const z=`eval-${Date.now()}`,re={id:z,name:`新评测组 ${Xt.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Ln(Ee=>[re,...Ee]),ue(z)},vt=z=>{Ur({...z,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+z.history.length%7,status:"completed"},...z.history]})};return l.jsxs("div",{className:`aw-root${g?" is-detail-only":""}`,children:[l.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[l.jsx("button",{type:"button",className:O==="library"?"is-active":"","aria-pressed":O==="library",onClick:()=>{F("library"),J("")},children:"智能体库"}),l.jsx("button",{type:"button",className:O==="evaluation"?"is-active":"","aria-pressed":O==="evaluation",onClick:()=>{F("evaluation"),J("")},children:"评测"})]}),l.jsxs("div",{className:"aw-workspace-frame",children:[l.jsxs("div",{className:"aw-workspace","aria-hidden":O==="evaluation"||void 0,ref:z=>z==null?void 0:z.toggleAttribute("inert",O==="evaluation"),children:[l.jsxs("aside",{className:"aw-sidebar","aria-label":O==="library"?"智能体列表":"评测组列表",children:[l.jsxs("label",{className:"aw-search",children:[l.jsx(gf,{"aria-hidden":!0}),l.jsx("input",{value:ce,onChange:z=>J(z.currentTarget.value),placeholder:O==="library"?"搜索智能体":"搜索评测组","aria-label":O==="library"?"搜索智能体":"搜索评测组"})]}),l.jsxs("button",{type:"button",className:"aw-create-card",onClick:O==="library"?S:Vs,disabled:O==="library"&&!a,children:[l.jsx(ir,{"aria-hidden":!0}),l.jsx("span",{children:O==="library"?"新建 Agent":"新建评测组"})]}),O==="library"&&(w||b)&&l.jsx("div",{className:`aw-selection-toolbar${et?" is-active":""}`,children:et?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"aw-selection-count",children:["已选 ",Jt," 个"]}),l.jsx("button",{type:"button",onClick:xa,disabled:Yt===0||ut,children:"全选"}),l.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void va(),disabled:Jt===0||ut,children:ut?"删除中…":"删除所选"}),l.jsx("button",{type:"button",onClick:wa,disabled:ut,children:"取消"})]}):l.jsx("button",{type:"button",onClick:()=>{he(""),Ge(!0)},disabled:Yt===0,children:"选择"})}),O==="library"&&ne&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:ne}),l.jsx("div",{className:"aw-agent-list",children:O==="evaluation"?ot.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):ot.map(z=>l.jsxs("button",{type:"button",className:`aw-agent-item${z.id===Mn?" is-active":""}`,onClick:()=>ue(z.id),children:[l.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[l.jsx("strong",{children:z.name}),l.jsxs("small",{children:[z.agentIds.length," 个智能体 · ",z.history.length," 次运行"]})]}),l.jsx(Cd,{"aria-hidden":!0})]},z.id)):c&&Ft.length===0&&Qe.length===0?l.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&Ft.length===0&&Qe.length===0?l.jsxs("div",{className:"aw-list-empty aw-list-error",children:[l.jsx("span",{children:u}),x&&l.jsx("button",{type:"button",onClick:x,children:"重试"})]}):Ft.length===0&&Qe.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):l.jsxs(l.Fragment,{children:[Qe.map(z=>{const re=d.filter($=>{var le,Re;return((le=$.agentDraft)==null?void 0:le.name)===z.draft.name||$.runtimeName===z.draft.name||!!((Re=z.deploymentTarget)!=null&&Re.runtimeId)&&$.runtimeId===z.deploymentTarget.runtimeId}).sort(($,le)=>le.startedAt-$.startedAt)[0],Ee=gt.has(z.id);return l.jsxs("button",{type:"button",className:["aw-agent-item",et?"is-selecting":"",Ee?"is-selected-for-delete":"",z.id===M?"is-active":""].filter(Boolean).join(" "),"aria-pressed":et?Ee:void 0,onClick:()=>{if(et){vl(z);return}T(""),I(""),j(z.id),L("basic")},children:[et&&l.jsx("span",{className:`aw-select-marker${Ee?" is-checked":""}`,"aria-hidden":"true"}),l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:z.draft.name||"未命名 Agent"}),l.jsx("span",{className:`aw-draft-badge${(re==null?void 0:re.status)==="running"?" is-deploying":""}`,children:(re==null?void 0:re.status)==="running"?"部署中":"草稿"})]}),l.jsx("small",{children:z.deploymentTarget?"待更新":"尚未发布"})]}),l.jsx(Cd,{"aria-hidden":!0})]},z.id)}),Ft.map(z=>{const re=z.runtimeId?ye.get(z.runtimeId):void 0,Ee=z.runtimeId?ve.get(z.runtimeId):void 0,$=Xe.has(z.id),le=z.canDelete===!0,Re=(re==null?void 0:re.status)==="running"?{label:"部署中",className:" is-deploying"}:(re==null?void 0:re.status)==="error"?{label:"失败",className:" is-error"}:(re==null?void 0:re.status)==="cancelled"?{label:"已取消",className:" is-muted"}:Ee?{label:"待更新",className:""}:null,$e=(re==null?void 0:re.status)==="running"?"正在更新部署":Ee?"待更新":z.remote?z.host||"远程智能体":"本地智能体",pt=["aw-agent-item","aw-agent-item--sortable",z.id===D?"is-active":"",et?"is-selecting":"",$?"is-selected-for-delete":"",et&&!le?"is-selection-disabled":"",z.id===Z?"is-dragging":"",z.id===Ne&&z.id!==Z?`is-drop-target is-drop-${We}`:""].filter(Boolean).join(" ");return l.jsxs("button",{type:"button",draggable:!!y&&!et,className:pt,"aria-pressed":et?$:void 0,"aria-keyshortcuts":y?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:at=>{y&&(Bt.current=!0,me(z.id),at.dataTransfer.effectAllowed="move",at.dataTransfer.setData("text/plain",z.id))},onDragEnter:at=>{Ea(at,z.id)},onDragOver:at=>{!Z||Z===z.id||(at.preventDefault(),at.dataTransfer.dropEffect="move",Ea(at,z.id))},onDragLeave:at=>{const lt=at.relatedTarget;lt instanceof Node&&at.currentTarget.contains(lt)||Ne===z.id&&Ie("")},onDrop:at=>{at.preventDefault();const lt=at.dataTransfer.getData("text/plain")||Z;Jn(lt,z.id,We),me(""),Ie(""),Ce("before")},onDragEnd:()=>{me(""),Ie(""),Ce("before"),window.setTimeout(()=>{Bt.current=!1},0)},onKeyDown:at=>{at.altKey&&(at.key==="ArrowUp"?(at.preventDefault(),Hi(z.id,-1)):at.key==="ArrowDown"&&(at.preventDefault(),Hi(z.id,1)))},onClick:at=>{if(et){at.preventDefault(),wl(z);return}if(Bt.current){at.preventDefault(),Bt.current=!1;return}I(""),j(""),T(z.id),L("basic"),_(z.id)},children:[et&&l.jsx("span",{className:`aw-select-marker${$?" is-checked":""}`,"aria-hidden":"true"}),l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:z.label}),z.currentVersion!=null&&l.jsxs("span",{className:"aw-version-badge",children:["v",z.currentVersion]}),Re&&l.jsx("span",{className:`aw-draft-badge${Re.className}`,children:Re.label})]}),l.jsx("small",{children:$e})]}),l.jsx(Cd,{"aria-hidden":!0})]},z.id)})]})}),l.jsxs("div",{className:"aw-list-count",children:["共 ",O==="library"?e.length+ct:Xt.length," 个"]})]}),O==="evaluation"&&or?l.jsx(Epe,{group:or,agents:e,cases:gr,onChange:Ur,onRun:vt}):O==="evaluation"?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择评测组"})}):!oe&&!Ze&&!It?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择智能体"})}):l.jsxs("main",{className:"aw-main",children:[oe&&!kt&&(i||g&&!Q)&&l.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"aw-detail-loading-card",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsxs("span",{children:[l.jsx("strong",{children:"正在加载智能体"}),l.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),l.jsxs("div",{className:"aw-agent-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:Zn}),(oe==null?void 0:oe.currentVersion)!=null&&l.jsxs("span",{children:["v",oe.currentVersion]}),Ze&&l.jsx("span",{children:"草稿"}),it&&l.jsx("span",{children:"待更新"}),!oe&&!Ze&&It&&l.jsx("span",{children:It.label})]}),l.jsx("p",{children:Mt.description||(i?"正在读取智能体信息…":"暂无描述")})]}),((oe==null?void 0:oe.canDelete)||Ze||it)&&l.jsxs("div",{className:"aw-head-actions",children:[(Ze||it)&&l.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const z=Ze??it;z&&_a(z)},disabled:ut,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(oe==null?void 0:oe.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void mo(oe),disabled:ut,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:ut?"删除中…":"删除 Agent"})]})]})]}),en&&en.status!=="success"&&l.jsx("div",{className:"aw-detail-deployment",children:l.jsx(gpe,{task:en})}),l.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",children:dpe.map(z=>l.jsx("button",{type:"button",className:q===z.id?"is-active":"","aria-pressed":q===z.id,onClick:()=>L(z.id),children:z.label},z.id))}),l.jsxs("div",{className:"aw-content",children:[q==="basic"&&l.jsxs("div",{className:"aw-basic-stack",children:[l.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"部署配置"}),l.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),l.jsxs("dl",{className:"aw-readonly-config",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"运行状态"}),l.jsxs("dd",{className:(K==null?void 0:K.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(K==null?void 0:K.status.toLowerCase())==="ready"&&l.jsx("span",{className:"aw-status-dot"}),(K==null?void 0:K.status)||"读取中…"]})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署区域"}),l.jsx("dd",{children:(K==null?void 0:K.region)||(oe==null?void 0:oe.region)||(en==null?void 0:en.region)||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"网络访问"}),l.jsx("dd",{children:K!=null&&K.networkTypes.length?K.networkTypes.join(" / "):"暂未提供"})]})]})]}),l.jsxs("section",{className:"aw-canvas-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"执行流程"})}),l.jsx("div",{className:"aw-canvas",children:hn?l.jsxs("div",{className:"aw-canvas-loading",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsx("span",{children:"正在加载执行流程"})]}):l.jsx(yg,{draft:Mt,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Vn)})]}),l.jsxs("section",{className:"aw-details-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"详细信息"})}),l.jsxs("dl",{className:"aw-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:(kt==null?void 0:kt.model)||Mt.modelName||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"智能体数量"}),l.jsx("dd",{children:kt!=null&&kt.graph?u6(kt.graph):ox(Mt)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"工具"}),l.jsx("dd",{className:"aw-fact-badges",children:Cn.length?Cn.map(z=>l.jsx("span",{children:z},z)):"暂无"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能"}),l.jsx("dd",{className:"aw-fact-badges",children:fn===null?"暂不支持预览":fn.length?fn.map(z=>l.jsx("span",{children:z},z)):"暂无"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:(K==null?void 0:K.currentVersion)!=null?`v${K.currentVersion}`:(oe==null?void 0:oe.currentVersion)!=null?`v${oe.currentVersion}`:"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:Ze?"草稿":(en==null?void 0:en.status)==="error"?"部署失败":(en==null?void 0:en.status)==="cancelled"?"已取消":it?"待更新":l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),l.jsxs("section",{className:"aw-option-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"优化项"}),l.jsx("p",{children:"针对运行质量开启专项优化策略。"})]})}),l.jsxs("div",{className:"aw-option-content",children:[l.jsx("div",{className:"aw-option-list","aria-disabled":"true",children:[["上下文优化","压缩冗余信息,保留对当前任务最有价值的上下文。"],["幻觉抑制","在证据不足时降低确定性表达并主动请求补充信息。"],["工具调用优化","减少重复调用,并优先复用已经获得的结果。"]].map(([z,re])=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",disabled:!0}),l.jsxs("span",{children:[l.jsx("strong",{children:z}),l.jsx("small",{children:re})]})]},z))}),l.jsx("div",{className:"aw-option-glass",role:"status",children:l.jsx("span",{children:"暂未开放"})})]})]})]}),q==="evaluations"&&l.jsxs("section",{className:"aw-cases",children:[oe!=null&&oe.runtimeId?l.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(z=>{const re=ppe(qe,z),Ee=(re==null?void 0:re.itemCount)??Te.filter($=>$.kind===z).length;return l.jsxs("button",{type:"button",onClick:()=>es(z),children:[l.jsx("strong",{children:Ee}),l.jsx("span",{children:z==="good"?"Good cases":"Bad cases"})]},z)})}):l.jsx("div",{className:"aw-case-note",children:"只有已部署到 AgentKit Runtime 的 Agent 会同步展示用户反馈评测集。"}),l.jsx("div",{className:"aw-case-filters",children:["good","bad"].map(z=>l.jsx("button",{type:"button",className:fe===z?"is-active":"","aria-pressed":fe===z,onClick:()=>te(z),children:z==="good"?"Good case":"Bad case"},z))}),l.jsxs("label",{className:"aw-case-search",children:[l.jsx(gf,{"aria-hidden":!0}),l.jsx("input",{type:"search",value:ge,onChange:z=>we(z.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]}),yr&&l.jsx("div",{className:`aw-case-toolbar${wn?" is-active":""}`,children:wn?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"aw-selection-count",children:["已选 ",bs.length," 条"]}),l.jsx("button",{type:"button",onClick:bi,disabled:Kn.length===0||_t,children:"全选当前"}),l.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void $i(bs),disabled:bs.length===0||_t,children:_t?"删除中…":"删除所选"}),l.jsx("button",{type:"button",onClick:po,disabled:_t,children:"取消"})]}):l.jsx("button",{type:"button",onClick:()=>{st(""),Fe(!0)},disabled:Kn.length===0||_t,children:"选择案例"})}),Ve&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:Ve}),l.jsx("div",{ref:vn,children:l.jsx(bpe,{cases:Kn,loading:Ye,error:Be,runtimeBacked:!!(oe!=null&&oe.runtimeId),selectionMode:wn,selectedCaseIds:dt,focusedCaseId:sn,expandedCaseIds:Ht,deleting:_t,canDelete:yr,onOpenCase:Ei,onToggleCase:Es,onToggleExpanded:xs,onDeleteCase:z=>void $i([z]),onRetry:()=>$t(z=>z+1)})})]})]}),q==="basic"&&(oe||Ze)&&l.jsxs("div",{className:"aw-basic-actions",children:[oe&&l.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>k==null?void 0:k(oe.id),children:[l.jsx(Tz,{"aria-hidden":!0}),l.jsx("span",{children:"去对话"})]}),l.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:Ze||it?!a:!(oe!=null&&oe.runtimeId)||!o||!i&&!kt,onClick:()=>Ze?R==null?void 0:R(Ze):it?R==null?void 0:R(it):C(Mt),children:Ze||it?"继续编辑":"更新"}),(Ze||it)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>{const z=Ze??it;z&&_a(z)},disabled:ut,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(oe==null?void 0:oe.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>void mo(oe),disabled:ut,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:ut?"删除中…":"删除 Agent"})]})]})]})]}),O==="evaluation"&&l.jsx("div",{className:"aw-evaluation-glass",role:"status",children:l.jsx("span",{children:"敬请期待"})})]})]})}function bpe({cases:e,loading:t=!1,error:n="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:i,focusedCaseId:a="",expandedCaseIds:o,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){return l.jsxs("div",{className:"aw-case-table",children:[l.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[l.jsx("span",{children:"用户输入"}),l.jsx("span",{children:"Agent 输出"}),l.jsx("span",{children:"来源"})]}),t?l.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?l.jsxs("div",{className:"aw-case-empty aw-case-error",children:[l.jsx("span",{children:n}),m&&l.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?l.jsx("div",{className:"aw-case-empty",children:r?"暂无用户反馈案例":"没有匹配的案例"}):e.map(g=>{const x=(i==null?void 0:i.has(g.id))??!1,y=(o==null?void 0:o.has(g.id))??!1,b=g.output.length+g.referenceOutput.length>220;return l.jsxs("div",{className:["aw-case-row",a===g.id?"is-focused":"",s?"is-selecting":"",x?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?x:void 0,onClick:()=>{if(s){f==null||f(g);return}d==null||d(g)},onKeyDown:_=>{_.target===_.currentTarget&&(_.key!=="Enter"&&_.key!==" "||(_.preventDefault(),s?f==null||f(g):d==null||d(g)))},children:[l.jsxs("div",{className:"aw-case-text",children:[l.jsxs("span",{className:"aw-case-title-line",children:[s&&l.jsx("span",{className:`aw-select-marker${x?" is-checked":""}`,"aria-hidden":"true"}),l.jsx("strong",{title:g.input,children:g.input||"无用户输入"})]}),g.comment&&l.jsxs("small",{title:g.comment,children:["备注:",g.comment]})]}),l.jsxs("div",{className:`aw-case-output${y?" is-expanded":""}`,children:[l.jsx("p",{className:"aw-case-output-preview",title:g.output,children:g.output||"无可见回复"}),g.referenceOutput&&l.jsxs("small",{className:"aw-case-output-preview",title:g.referenceOutput,children:["Reference: ",g.referenceOutput]}),b&&l.jsx("button",{type:"button",className:"aw-case-expand",onClick:_=>{_.stopPropagation(),h==null||h(g.id)},children:y?"收起":"展开"})]}),l.jsxs("div",{className:"aw-case-meta",children:[l.jsxs("span",{className:"aw-case-meta-top",children:[l.jsx("span",{className:`aw-case-tag is-${g.kind}`,children:g.kind==="good"?"Good case":"Bad case"}),u&&l.jsx("button",{type:"button",className:"aw-case-delete",onClick:_=>{_.stopPropagation(),p==null||p(g)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:l.jsx(js,{"aria-hidden":!0})})]}),l.jsx("small",{children:hpe(g.createdAt)}),(g.userId||g.sessionId)&&l.jsx("small",{title:[g.userId,g.sessionId].filter(Boolean).join(" · "),children:[g.userId,g.sessionId].filter(Boolean).join(" · ")})]})]},g.id)})]})}function Epe({group:e,agents:t,cases:n,onChange:r,onRun:s}){const[i,a]=E.useState("config"),o=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];E.useEffect(()=>a("config"),[e.id]);const u=f=>{r({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{r({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return l.jsxs("main",{className:"aw-main",children:[l.jsxs("div",{className:"aw-eval-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:e.name}),l.jsx("span",{children:"评测组"})]}),l.jsxs("p",{children:[o.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),l.jsxs("button",{type:"button",className:"aw-run",onClick:()=>s(e),disabled:!0,children:[l.jsx(gz,{"aria-hidden":!0}),"开始评测"]})]}),l.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[l.jsx("button",{type:"button",className:i==="config"?"is-active":"","aria-pressed":i==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),l.jsx("button",{type:"button",className:i==="history"?"is-active":"","aria-pressed":i==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),l.jsx("div",{className:"aw-content",children:i==="config"?l.jsxs("div",{className:"aw-eval-setup",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"参评智能体"}),l.jsxs("span",{children:["已选择 ",o.length," 个"]})]}),l.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),l.jsxs("span",{children:[l.jsx("strong",{children:f.label}),l.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),l.jsxs("div",{className:"aw-eval-setting-grid",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"评测资源"})}),l.jsxs("div",{className:"aw-eval-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"评测集"}),l.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[l.jsx("option",{children:"核心回归集"}),l.jsx("option",{children:"安全边界集"}),l.jsx("option",{children:"工具调用集"})]}),l.jsxs("small",{children:[n.length," 条案例"]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"评估器"}),l.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[l.jsx("option",{children:"综合质量评估器"}),l.jsx("option",{children:"事实一致性评估器"}),l.jsx("option",{children:"工具调用评估器"})]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"并发数"}),l.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[l.jsx("option",{value:"2",children:"2"}),l.jsx("option",{value:"4",children:"4"}),l.jsx("option",{value:"8",children:"8"})]})]})]})]}),l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"评测指标"}),l.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),l.jsx("div",{className:"aw-metric-list",children:c.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),l.jsx("span",{children:f})]},f))})]})]})]}):l.jsxs("section",{className:"aw-eval-history",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"历史结果"}),l.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?l.jsxs("div",{className:"aw-results-empty",children:[l.jsx("strong",{children:"暂无历史结果"}),l.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):l.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>l.jsxs("button",{type:"button",children:[l.jsxs("span",{children:[l.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),l.jsxs("small",{children:[f.createdAt," · ",o.length," 个智能体"]})]}),l.jsxs("span",{className:"aw-history-score",children:[l.jsx("strong",{children:f.score}),l.jsx("small",{children:"综合得分"})]}),l.jsxs("span",{className:"aw-complete",children:[l.jsx(pi,{}),"已完成"]}),l.jsx(Cd,{"aria-hidden":!0})]},f.id))})]})})]})}const lC=2,xpe=174,cC=12;function d6(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t).replace(/\//g,"-")}function wpe(e){return{id:e.runtimeId,name:e.name,description:e.name,toolCount:0,skillCount:0,createdAt:d6(e.createdAt??""),runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}async function vpe(e,t,n){const r=await yc({scope:"mine",region:"all",pageSize:t,nextToken:e});return n(r.runtimes.map(wpe)),Promise.all(r.runtimes.map(async s=>{try{const i=await e0(s.runtimeId,s.region),a={id:s.runtimeId,name:i.name||s.name,description:i.description||s.name,toolCount:i.tools.length,skillCount:i.skills.length,createdAt:d6(s.createdAt??""),runtime:{runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion,canDelete:s.canDelete}};n([a])}catch{}})),{nextToken:r.nextToken,count:r.runtimes.length}}function _pe({agent:e,onUse:t,onViewDetails:n,connecting:r,connected:s}){return l.jsxs("article",{className:"my-agent-card",children:[l.jsxs("div",{className:"my-agent-card-content",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{className:"my-agent-description",children:e.description}),l.jsxs("dl",{className:"my-agent-meta",children:[l.jsxs("div",{className:"my-agent-label",children:[l.jsx("dt",{children:"工具"}),l.jsxs("dd",{children:[e.toolCount," 个"]})]}),l.jsxs("div",{className:"my-agent-label",children:[l.jsx("dt",{children:"技能"}),l.jsxs("dd",{children:[e.skillCount," 个"]})]}),l.jsxs("div",{className:"my-agent-created-at",children:[l.jsx("dt",{children:"创建时间"}),l.jsx("dd",{children:e.createdAt})]})]})]}),l.jsxs("div",{className:"my-agent-actions",children:[l.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!e.runtime||r||s,"aria-busy":r||void 0,onClick:()=>void(t==null?void 0:t(e)),children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),l.jsx("span",{children:"连接中"})]}):s?"已连接":"使用"}),l.jsx("button",{type:"button",className:"my-agent-details",disabled:!e.runtime,onClick:()=>n==null?void 0:n(e),children:"查看详情"})]})]})}function kpe({section:e,onCreateAgent:t,onUseAgent:n,onViewAgentDetails:r,connectingAgentId:s,connectedRuntimeId:i,loading:a,serverPagination:o,onPageSizeChange:c,comingSoon:u}){const d=E.useRef(null),[f,h]=E.useState(1),[p,m]=E.useState(1),g=Math.max(1,f*lC-1),x=Math.max(1,Math.ceil(e.agents.length/g)),y=E.useMemo(()=>o?e.agents:e.agents.slice((p-1)*g,p*g),[p,g,e.agents,o]),w=(o==null?void 0:o.page)??p;return E.useEffect(()=>{const b=d.current;if(!b)return;const _=()=>{const N=b.getBoundingClientRect().width,A=Math.max(1,Math.floor((N+cC)/(xpe+cC)));h(A),c==null||c(Math.max(1,A*lC-1))};_();const k=new ResizeObserver(_);return k.observe(b),()=>k.disconnect()},[c]),E.useEffect(()=>{m(b=>Math.min(b,x))},[x]),l.jsxs("section",{className:"my-agents-section",children:[l.jsx("h2",{children:e.title}),l.jsxs("div",{className:"my-agent-section-content",children:[l.jsxs("div",{className:"my-agent-grid",ref:d,children:[l.jsxs("button",{type:"button",className:"my-agent-add","aria-label":`添加${e.title}`,disabled:!t||u,onClick:t,children:[l.jsx(ir,{"aria-hidden":"true"}),l.jsx("span",{children:"添加智能体"})]}),y.map(b=>{var _;return l.jsx(_pe,{agent:b,onUse:n,onViewDetails:r,connecting:b.id===s,connected:((_=b.runtime)==null?void 0:_.runtimeId)===i},b.id)}),a&&l.jsxs("div",{className:"my-agent-loading",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsx("span",{children:"加载中"})]})]}),l.jsxs("nav",{className:"my-agent-pagination","aria-label":`${e.title}分页`,children:[l.jsx("button",{type:"button","aria-label":"上一页",disabled:w===1||a,onClick:(o==null?void 0:o.onPrevious)??(()=>m(p-1)),children:"‹"}),l.jsx("span",{children:o?w:`${p} / ${x}`}),l.jsx("button",{type:"button","aria-label":"下一页",disabled:a||(o?!o.hasNext:p===x),onClick:(o==null?void 0:o.onNext)??(()=>m(p+1)),children:"›"})]}),u&&l.jsx("div",{className:"my-agent-coming-soon-overlay",role:"status",children:"敬请期待"})]})]})}function Npe({onCreateAgent:e,onCreateCodexAgent:t,onUseAgent:n,onViewAgentDetails:r,connectedRuntimeId:s=""}){const[i,a]=E.useState([]),[o,c]=E.useState(!0),[u,d]=E.useState(1),[f,h]=E.useState(""),[p,m]=E.useState(0),[g,x]=E.useState(""),y=E.useRef(0),w=E.useRef([""]),b=E.useRef(0),_=E.useCallback(O=>{y.current!==O&&(y.current=O,m(O))},[]),k=E.useCallback((O,F,q)=>{const L=++b.current;return c(!0),vpe(F,q,D=>{b.current===L&&(O>1&&D.length===0||a(T=>D.length!==1||T.length===0?D:T.map(M=>M.id===D[0].id?D[0]:M)))}).then(({nextToken:D,count:T})=>{if(b.current===L){if(O>1&&T===0){h("");return}d(O),h(D)}}).catch(()=>{b.current}).finally(()=>{b.current===L&&c(!1)})},[]);E.useEffect(()=>{if(p!==0)return w.current=[""],h(""),k(1,"",p),()=>{b.current+=1}},[k,p]);const N=()=>{f&&(w.current[u]=f,k(u+1,f,p))},A=()=>{if(u<=1)return;const O=u-1,F=w.current[O-1]??"";k(O,F,p)},S=E.useCallback(async O=>{if(!g){x(O.id);try{await new Promise(F=>requestAnimationFrame(()=>F())),await n(O)}finally{x("")}}},[g,n]),C=E.useMemo(()=>[{title:"通用智能体",agents:i},{title:"Codex 智能体",agents:[]},{title:"OpenClaw 智能体",agents:[],comingSoon:!0},{title:"Hermes 智能体",agents:[],comingSoon:!0}],[i]),R=[e,t,void 0,void 0];return l.jsxs("div",{className:"my-agents-page",children:[!s&&l.jsx("div",{className:"my-agents-connect-banner",role:"status",children:"请选择一个智能体以对话"}),C.map((O,F)=>l.jsx(kpe,{section:O,onCreateAgent:R[F],onUseAgent:S,onViewAgentDetails:r,connectingAgentId:g,connectedRuntimeId:s,loading:F===0&&o,onPageSizeChange:F===0?_:void 0,serverPagination:F===0?{page:u,hasNext:!!f,onPrevious:A,onNext:N}:void 0,comingSoon:O.comingSoon},O.title))]})}const Spe={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function Tpe(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function Ape(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function Cpe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function m_(e,t){if(Ape(e))return Tpe(t,e.path);if(Cpe(e)){const n=Spe[e.call],r={};for(const[s,i]of Object.entries(e.args??{}))r[s]=m_(i,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function Ipe(e,t){const n=m_(e,t);return n==null?"":typeof n=="string"?n:String(n)}const f6=new Map;function El(e,t){f6.set(e,t)}function Rpe(e){return f6.get(e)}function Ope(e,t,n){const r=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let i=0;im_(r,e.dataModel),resolveString:r=>Ipe(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const s=e.components[r];if(!s)return null;const i=Rpe(s.component)??Lpe;return l.jsx(i,{node:s,ctx:n},r)}};return l.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function jpe(e){const t=E.useRef(null),n=E.useRef(!0),r=28,s=E.useCallback(()=>{const i=t.current;i&&(n.current=i.scrollHeight-i.scrollTop-i.clientHeight{const i=t.current;i&&n.current&&(i.scrollTop=i.scrollHeight)},[e]),{ref:t,onScroll:s}}function g_({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:l.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>l.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[l.jsx(nl,{"aria-hidden":!0}),l.jsxs("span",{children:["/",r.name]}),t?l.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:l.jsx(Zr,{})}):null]},r.name)),e.targetAgent?l.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[l.jsx(qL,{"aria-hidden":!0}),l.jsx("span",{children:e.targetAgent.name}),n?l.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:l.jsx(Zr,{})}):null]}):null]})}function y_(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function p6(e){var n,r,s,i;const t=y_(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((i=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:i.toUpperCase())??"IMAGE":"TXT"}function m6(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function g6(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?wM(t,e.uri):""}function Dpe({kind:e}){return e==="image"?l.jsx(nM,{}):e==="video"?l.jsx(eM,{}):e==="pdf"?l.jsx(pz,{}):l.jsx(JL,{})}function b_({appName:e,items:t,compact:n=!1,onRemove:r}){const[s,i]=E.useState(null);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=y_(a.mimeType),c=g6(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=l.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>i(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&c?l.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):o==="video"&&c?l.jsxs("div",{className:"media-card-video-container",children:[l.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),l.jsx("span",{className:"media-card-video-play",children:l.jsx(Mz,{})})]}):l.jsx("span",{className:"media-card-icon",children:l.jsx(Dpe,{kind:o})}),l.jsxs("span",{className:"media-card-copy",children:[l.jsx("span",{className:"media-card-name",children:a.name??"附件"}),l.jsxs("span",{className:"media-card-meta",children:[l.jsx("span",{className:"media-card-type",children:p6(a)}),a.status==="uploading"?l.jsxs(l.Fragment,{children:[l.jsx(Kt,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":m6(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?l.jsx(gc,{className:"media-card-open"}):null]});return l.jsxs(Wt.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?l.jsx(KL,{src:c,children:d}):d,r?l.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:l.jsx(Zr,{})}):null]},a.id)})}),l.jsx(ni,{children:s?l.jsx(Ppe,{appName:e,item:s,onClose:()=>i(null)}):null})]})}function Ppe({appName:e,item:t,onClose:n}){const r=E.useMemo(()=>g6(t,e),[e,t]),s=y_(t.mimeType),[i,a]=E.useState(""),[o,c]=E.useState(s==="text"||s==="markdown"),[u,d]=E.useState("");return E.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),E.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[s,r]),l.jsx(Wt.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:l.jsxs(Wt.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[l.jsxs("header",{className:"media-viewer-header",children:[l.jsxs("div",{children:[l.jsx("strong",{children:t.name??"附件"}),l.jsxs("span",{children:[p6(t),t.sizeBytes?` · ${m6(t.sizeBytes)}`:""]})]}),l.jsxs("nav",{children:[l.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:l.jsx(Jw,{})}),l.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:l.jsx(Zr,{})})]})]}),l.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?l.jsx("img",{src:r,alt:t.name??"图片"}):null,s==="video"?l.jsx("div",{className:"media-viewer-video-wrapper",children:l.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?l.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?l.jsxs("div",{className:"media-viewer-loading",children:[l.jsx(Kt,{})," 正在读取文档…"]}):null,!o&&u?l.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&s==="markdown"?l.jsx("div",{className:"media-document",children:l.jsx(sh,{text:i})}):null,!o&&s==="text"?l.jsx("pre",{className:"media-document media-document--plain",children:i}):null]})]})})}function Bpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),l.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function Fpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),l.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),l.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),l.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function Upe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),l.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),l.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function $pe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),l.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),l.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function Hpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),l.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),l.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),l.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function zpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),l.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),l.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function Vpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),l.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),l.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),l.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function y6(e){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:l.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Kpe({definition:e,label:t,done:n,open:r,onToggle:s}){const i=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return l.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:s,"aria-expanded":r,children:[l.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:l.jsx(i,{})}),n?l.jsx("span",{className:"builtin-tool-label",children:a}):l.jsx(pa,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),l.jsx(y6,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const Ype={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Bpe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:Vpe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Fpe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:Upe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:$pe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:Hpe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:zpe}};function Gpe(e){return Ype[e]}const b6="send_a2ui_json_to_client",Wpe=28;function qpe(e,t,n){let r=t;for(let s=0;s65535?2:1}return r}function Xpe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function E6(e,t,n){const[r,s]=E.useState(()=>t?"":e),i=E.useRef(r),a=E.useRef(e),o=E.useRef(null),c=E.useRef(0),u=E.useRef(n);return a.current=e,u.current=n,E.useEffect(()=>{const d=i.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null,d!==e&&(i.current=e,s(e));return}if(d===e||o.current!==null)return;const h=p=>{const m=a.current,g=i.current;if(!m.startsWith(g)){i.current=m,s(m),o.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[r]),E.useEffect(()=>()=>{o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)},[]),r}function Qpe({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Zpe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function Jpe(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function x6({text:e,done:t,streaming:n=!1,onStreamFrame:r}){const[s,i]=E.useState(!t),a=E.useRef(!1);E.useEffect(()=>{a.current||i(!t)},[t]);const o=()=>{a.current=!0,i(h=>!h)},c=e.replace(/^\s+/,""),u=E6(c,!t||n,r),{ref:d,onScroll:f}=jpe(u);return l.jsxs("div",{className:"block-thinking",children:[l.jsxs("button",{className:"think-head",onClick:o,type:"button",children:[l.jsx("span",{className:"think-icon","aria-hidden":"true",children:l.jsx(Qpe,{className:`spark ${t?"":"pulse"}`})}),t?l.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):l.jsx(pa,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),l.jsx(Ms,{className:`chev ${s?"open":""}`})]}),l.jsx("div",{className:`think-collapse ${s&&u?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsx("div",{className:"think-body scroll",ref:d,onScroll:f,children:u})})})]})}function w6(){return l.jsx(x6,{text:"",done:!1})}const eme=E.memo(function({text:t,streaming:n,onStreamFrame:r}){const s=E6(t,n,r);return s?l.jsx("div",{className:"bubble",children:l.jsx(sh,{text:s})}):null});function tme({name:e,args:t,response:n,done:r}){const[s,i]=E.useState(!1),a=e===b6?"渲染 UI":e,o=Gpe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` -…(已截断)`:c;return l.jsxs(Wt.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?l.jsx(Kpe,{definition:o,label:Jpe(e,t),done:r,open:s,onToggle:()=>i(d=>!d)}):l.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>i(d=>!d),type:"button","aria-expanded":s,children:[l.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:l.jsx(Zpe,{})}),r?l.jsx("span",{className:"tool-name",children:a}):l.jsx(pa,{className:"tool-name",duration:2.2,spread:15,children:a}),l.jsx(y6,{className:`tool-chevron${s?" is-open":""}`})]}),l.jsx("div",{className:`think-collapse ${s?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsxs("div",{className:"tool-detail",children:[t!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"参数"}),l.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"返回"}),l.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function nme({block:e,onAuth:t}){const[n,r]=E.useState(e.done?"done":"idle"),[s,i]=E.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){i(""),r("authorizing");try{await t(e),r("done")}catch(d){i(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?l.jsxs(Wt.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[l.jsx(BS,{className:"auth-card-icon auth-card-icon--done"}),l.jsxs("span",{children:["已授权 · ",a]})]}):l.jsxs(Wt.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"auth-card-head",children:[l.jsx(BS,{className:"auth-card-icon"}),l.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),l.jsxs("p",{className:"auth-card-desc",children:["工具集 ",l.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&l.jsxs(l.Fragment,{children:[" ","将跳转至 ",l.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),l.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?l.jsxs(l.Fragment,{children:[l.jsx(Kt,{className:"cw-i spin"})," 等待授权…"]}):l.jsx(l.Fragment,{children:"去授权"})}),!e.authUri&&l.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&l.jsx("div",{className:"auth-card-err",children:s})]})}function E_({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onAction:s,onAuth:i}){return l.jsx(l.Fragment,{children:e.map((a,o)=>{switch(a.kind){case"thinking":return l.jsx(x6,{text:a.text,done:a.done,streaming:n,onStreamFrame:r},o);case"text":{const c=a.text.replace(/^\s+/,"");return c?l.jsx(eme,{text:c,streaming:n,onStreamFrame:r},o):null}case"attachment":return l.jsx(b_,{appName:t,items:a.files},o);case"invocation":return l.jsx(g_,{value:a.value},o);case"tool":return a.name===b6&&a.done?null:l.jsx(tme,{name:a.name,args:a.args,response:a.response,done:a.done},o);case"agent-transfer":return null;case"auth":return l.jsx(nme,{block:a,onAuth:i},o);case"a2ui":return h6(a.messages).filter(c=>c.components[c.rootId]).map(c=>l.jsx(Wt.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:l.jsx(Mpe,{surface:c,onAction:s})},`${o}-${c.surfaceId}`));default:return null}})})}function v6(e){return e.isComposing||e.keyCode===229}const rme="/assets/arkclaw-DG3MhHYM.png",sme="/assets/codex-Csw-JJxq.png",ime="/assets/hermes-C6L-CfGS.png",qs=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],ame=[{label:"ArkClaw",logo:rme},{label:"Hermes 智能体",logo:ime}];function uC({mode:e}){return e==="skill-create"?l.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),l.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?l.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),l.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):l.jsx(Pc,{className:"new-chat-mode__agent-icon"})}function ome(){return l.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function lme({value:e,onChange:t,disabled:n=!1,temporaryEnabled:r,skillCreateEnabled:s}){const[i,a]=E.useState(!1),[o,c]=E.useState(!1),[u,d]=E.useState(()=>qs.findIndex(k=>k.value===e)),f=E.useRef(null),h=E.useRef(null),p=qs.find(k=>k.value===e)??qs[0],m=p.value==="temporary"?"Codex 智能体":p.label;function g(k){return k.value==="temporary"?r:k.value==="skill-create"?s:!0}function x(k){return g(k)!==!0}function y(k){const N=g(k);return N===void 0?"正在检查配置":N?k.description:"管理员未配置"}E.useEffect(()=>{if(!i)return;const k=N=>{var A;(A=f.current)!=null&&A.contains(N.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]);function w(k){let N=u;do N=(N+k+qs.length)%qs.length;while(x(qs[N]));d(N),c(qs[N].value==="temporary")}function b(k){var N;if(!x(k)){if(k.value==="temporary"){c(!0);return}t(k.value),a(!1),c(!1),(N=h.current)==null||N.focus()}}function _(){t("temporary"),a(!1),c(!1)}return l.jsxs("div",{className:"new-chat-mode",ref:f,children:[l.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":i,disabled:n,onClick:()=>{d(qs.findIndex(k=>k.value===e)),a(k=>(k&&c(!1),!k))},onKeyDown:k=>{k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),i?w(k.key==="ArrowDown"?1:-1):a(!0)):i&&(k.key==="Enter"||k.key===" ")?(k.preventDefault(),b(qs[u])):i&&k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1))},children:[l.jsx("span",{className:"new-chat-mode__icon",children:l.jsx(uC,{mode:p.value})}),l.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),l.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),i?l.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:k=>{var N;k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),w(k.key==="ArrowDown"?1:-1)):k.key==="Enter"?(k.preventDefault(),b(qs[u])):k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1),(N=h.current)==null||N.focus())},children:qs.map((k,N)=>{const A=k.value==="temporary";return l.jsxs("button",{type:"button",role:"option","aria-selected":e===k.value,"aria-haspopup":A?"menu":void 0,"aria-expanded":A?o:void 0,"aria-disabled":x(k),disabled:x(k),className:`new-chat-mode__option${N===u?" is-active":""}`,onMouseEnter:()=>{d(N),c(k.value==="temporary")},onClick:()=>b(k),children:[l.jsx("span",{className:"new-chat-mode__option-icon",children:l.jsx(uC,{mode:k.value})}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsxs("span",{className:"new-chat-mode__label",children:[k.label,k.value==="skill-create"?l.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),l.jsx("span",{children:y(k)})]}),A?l.jsx(ome,{}):e===k.value?l.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},k.value)})}):null,i&&o?l.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:_,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:sme,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),l.jsx("span",{children:"在沙箱中执行任务"})]})]}),ame.map(({label:k,logo:N})=>l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:N,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:k}),l.jsx("span",{children:"暂不可用"})]})]},k))]}):null]})}const x_=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function cme(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"8.2",cy:"8.2",r:"4.7"}),l.jsx("path",{d:"m11.7 11.7 4.1 4.1"}),l.jsx("path",{d:"M14.8 2.7v3.2M13.2 4.3h3.2"}),l.jsx("circle",{cx:"8.2",cy:"8.2",r:"1",fill:"currentColor",stroke:"none"})]})}function ume(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"4.2",cy:"15.4",r:"1.4"}),l.jsx("circle",{cx:"15.7",cy:"4.2",r:"1.4"}),l.jsx("path",{d:"M5.7 15.1c3.5-.3 1.8-4.7 5.1-5.1 2.8-.4 2.1-3.7 3.5-4.8"}),l.jsx("path",{d:"m12.7 14.2 1.5 1.5 2.9-3.3"})]})}function dme(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M3.2 5.2h7.1M3.2 9.5h5.2M3.2 13.8h4"}),l.jsx("path",{d:"m10.1 14.8.6-2.8 4.7-4.7 2.2 2.2-4.7 4.7-2.8.6Z"}),l.jsx("path",{d:"M14.5 3.1v2.5M13.2 4.4h2.6"})]})}const fme=[{icon:cme,text:"帮我分析一个问题,并给出清晰的解决思路"},{icon:ume,text:"根据我的目标,制定一份可执行的行动计划"},{icon:dme,text:"帮我整理并润色一段内容,让表达更清晰"}];function hme({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:s,onChange:i,onSubmit:a,disabled:o,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:g=!0,onInvocationChange:x,onAddFiles:y,onRemoveAttachment:w,newChatMode:b="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:N,temporaryEnabled:A,skillCreateEnabled:S}){const C=E.useRef(null),R=E.useRef(null),O=E.useRef(null),F=E.useRef(null),[q,L]=E.useState(!1),[D,T]=E.useState(null),[M,j]=E.useState(0),[U,I]=E.useState(!1);async function K(){if(e)try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{I(!1)}}E.useLayoutEffect(()=>{const Z=C.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,200)}px`)},[s]);const W=b==="skill-create";E.useEffect(()=>{W&&(L(!1),T(null))},[W]);const B=!W&&d.some(Z=>Z.status!=="ready"),ie=!o&&!c&&!B&&(s.trim().length>0||!W&&d.length>0),Q=(D==null?void 0:D.query.toLocaleLowerCase())??"",ee=(D==null?void 0:D.kind)==="skill"?f.filter(Z=>!p.skills.some(me=>me.name===Z.name)).filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(Q)).map(Z=>({kind:"skill",value:Z})):(D==null?void 0:D.kind)==="agent"?h.filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(Q)).map(Z=>({kind:"agent",value:Z})):[];function ce(Z){var me;L(!1),T(null),(me=Z.current)==null||me.click()}function J(Z){i(Z),L(!1),T(null),requestAnimationFrame(()=>{var me,Ne;(me=C.current)==null||me.focus(),(Ne=C.current)==null||Ne.setSelectionRange(Z.length,Z.length)})}function fe(Z,me){const Ne=Z.slice(0,me),Ie=/(^|\s)([/@])([^\s/@]*)$/.exec(Ne);if(!Ie){T(null);return}const We=Ie[2].length+Ie[3].length,Ce={kind:Ie[2]==="/"?"skill":"agent",query:Ie[3],start:me-We,end:me},et=!D||D.kind!==Ce.kind||D.query!==Ce.query||D.start!==Ce.start||D.end!==Ce.end;T(Ce),et&&j(0),L(!1)}function te(Z){if(!D)return;const me=s.slice(0,D.start)+s.slice(D.end);i(me),Z.kind==="skill"?x({...p,skills:[...p.skills,Z.value]}):x({skills:[],targetAgent:Z.value});const Ne=D.start;T(null),requestAnimationFrame(()=>{var Ie,We;(Ie=C.current)==null||Ie.focus(),(We=C.current)==null||We.setSelectionRange(Ne,Ne)})}function ge(){if(p.targetAgent){x({skills:[]});return}p.skills.length>0&&x({...p,skills:p.skills.slice(0,-1)})}function we(Z){const me=Z.target.files?Array.from(Z.target.files):[];me.length&&y(me),Z.target.value=""}return l.jsxs("div",{className:`composer${_?" composer--new-chat":""}${W?" composer--skill-mode":""}`,children:[W?null:l.jsx(g_,{value:p,onRemoveSkill:Z=>x({...p,skills:p.skills.filter(me=>me.name!==Z)}),onRemoveAgent:()=>x({skills:[]})}),!W&&d.length>0&&l.jsx(b_,{appName:n,compact:!0,items:d,onRemove:w}),l.jsxs("div",{className:"composer-box",children:[D?l.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":D.kind==="skill"?"可用技能":"可用子 Agent",children:[l.jsxs("div",{className:"composer-command-head",children:[D.kind==="skill"?l.jsx(nl,{}):l.jsx(qL,{}),l.jsx("span",{children:D.kind==="skill"?"调用技能":"使用子 Agent"}),l.jsx("kbd",{children:D.kind==="skill"?"/":"@"})]}),m?l.jsxs("div",{className:"composer-command-empty",children:[l.jsx(Kt,{className:"spin"})," 正在读取 Agent 能力…"]}):ee.length===0?l.jsx("div",{className:"composer-command-empty",children:D.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):l.jsx("div",{className:"composer-command-list",children:ee.map((Z,me)=>l.jsxs("button",{type:"button",role:"option","aria-selected":me===M,className:`composer-command-item${me===M?" is-active":""}`,onMouseDown:Ne=>{Ne.preventDefault(),te(Z)},onMouseEnter:()=>j(me),children:[l.jsx("span",{className:`composer-command-icon composer-command-icon--${Z.kind}`,children:Z.kind==="skill"?l.jsx(nl,{}):l.jsx(tl,{})}),l.jsxs("span",{className:"composer-command-copy",children:[l.jsxs("strong",{children:[Z.kind==="skill"?"/":"@",Z.value.name]}),l.jsx("span",{children:Z.value.description||(Z.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),l.jsx("kbd",{children:me===M?"↵":Z.kind==="skill"?"技能":"Agent"})]},`${Z.kind}-${Z.value.name}`))})]}):null,W?null:l.jsxs("div",{className:"composer-menu-wrap",children:[l.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!g,onClick:()=>{T(null),L(Z=>!Z)},children:l.jsx(ir,{className:"icon"})}),q&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>L(!1)}),l.jsxs("div",{className:"composer-menu",role:"menu",children:[l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(R),children:[l.jsx(nM,{className:"icon"}),"上传图片"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(O),children:[l.jsx(JL,{className:"icon"}),"上传文档或 PDF"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(F),children:[l.jsx(eM,{className:"icon"}),"上传视频"]})]})]})]}),k&&N?l.jsx(lme,{value:b,onChange:N,disabled:c,temporaryEnabled:A,skillCreateEnabled:S}):null,l.jsx("div",{className:"composer-input-stack",children:l.jsx("textarea",{ref:C,className:"comp-input scroll",rows:_?4:1,value:s,disabled:o,placeholder:W?`描述你想创建的 Skill,将使用 ${x_.join(" 和 ")} 并行创建…`:o?"请在页面左上角选择智能体":`向 ${r} 发消息…`,"aria-expanded":!!D,onChange:Z=>{i(Z.target.value),W||fe(Z.target.value,Z.target.selectionStart)},onSelect:Z=>{W||fe(Z.currentTarget.value,Z.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>T(null),0),onKeyDown:Z=>{if(!v6(Z.nativeEvent)){if(D){if(Z.key==="ArrowDown"&&ee.length>0){Z.preventDefault(),j(me=>(me+1)%ee.length);return}if(Z.key==="ArrowUp"&&ee.length>0){Z.preventDefault(),j(me=>(me-1+ee.length)%ee.length);return}if((Z.key==="Enter"||Z.key==="Tab")&&ee[M]){Z.preventDefault(),te(ee[M]);return}if(Z.key==="Escape"){Z.preventDefault(),T(null);return}}if(Z.key==="Backspace"&&!s&&Z.currentTarget.selectionStart===0&&Z.currentTarget.selectionEnd===0){ge();return}Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),ie&&a())}}})}),l.jsx(Wt.button,{type:"button",className:"comp-send",disabled:!ie,onClick:a,"aria-label":"发送",whileTap:ie?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?l.jsx(Kt,{className:"icon spin"}):l.jsx(WL,{className:"icon"})})]}),_&&b==="agent"&&!s.trim()?l.jsx("div",{className:"prompt-suggestions","aria-label":"快捷提示",children:fme.map(Z=>{const me=Z.icon;return l.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:o||c,onClick:()=>J(Z.text),children:[l.jsx(me,{}),l.jsx("span",{children:Z.text})]},Z.text)})}):null,u&&l.jsxs("div",{className:"composer-meta",children:[l.jsxs("span",{className:"composer-session-line",children:["会话 ID:",l.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&l.jsx("button",{type:"button",className:"composer-session-copy",title:U?"已复制":"复制会话 ID","aria-label":U?"已复制会话 ID":"复制会话 ID",onClick:()=>void K(),children:U?l.jsx(pi,{}):l.jsx(Zw,{})})]}),l.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),l.jsx("span",{children:"回答仅供参考"})]}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:we}),l.jsx("input",{ref:O,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:we}),l.jsx("input",{ref:F,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:we})]})}function _6({title:e,sub:t,cards:n,footer:r}){return l.jsxs("div",{className:"stk",children:[l.jsxs("div",{className:"stk-head",children:[l.jsx("h1",{className:"stk-title",children:e}),t&&l.jsx("p",{className:"stk-sub",children:t})]}),l.jsx("div",{className:"stk-list",children:n.map((s,i)=>l.jsxs(Wt.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:i*.04},children:[l.jsx("span",{className:"stk-card-icon",children:l.jsx(s.icon,{})}),l.jsxs("span",{className:"stk-card-text",children:[l.jsx("span",{className:"stk-card-title",children:s.title}),l.jsx("span",{className:"stk-card-desc",children:s.desc})]}),l.jsx(Ms,{className:"stk-card-arrow"})]},s.key))}),r&&l.jsx("div",{className:"stk-footer",children:r})]})}const w_=Symbol.for("yaml.alias"),ux=Symbol.for("yaml.document"),to=Symbol.for("yaml.map"),k6=Symbol.for("yaml.pair"),Pi=Symbol.for("yaml.scalar"),yu=Symbol.for("yaml.seq"),$s=Symbol.for("yaml.node.type"),bu=e=>!!e&&typeof e=="object"&&e[$s]===w_,fh=e=>!!e&&typeof e=="object"&&e[$s]===ux,hh=e=>!!e&&typeof e=="object"&&e[$s]===to,Un=e=>!!e&&typeof e=="object"&&e[$s]===k6,rn=e=>!!e&&typeof e=="object"&&e[$s]===Pi,ph=e=>!!e&&typeof e=="object"&&e[$s]===yu;function Bn(e){if(e&&typeof e=="object")switch(e[$s]){case to:case yu:return!0}return!1}function Fn(e){if(e&&typeof e=="object")switch(e[$s]){case w_:case to:case Pi:case yu:return!0}return!1}const N6=e=>(rn(e)||Bn(e))&&!!e.anchor,Co=Symbol("break visit"),pme=Symbol("skip children"),zd=Symbol("remove node");function Eu(e,t){const n=mme(t);fh(e)?ac(null,e.contents,n,Object.freeze([e]))===zd&&(e.contents=null):ac(null,e,n,Object.freeze([]))}Eu.BREAK=Co;Eu.SKIP=pme;Eu.REMOVE=zd;function ac(e,t,n,r){const s=gme(e,t,n,r);if(Fn(s)||Un(s))return yme(e,r,s),ac(e,s,n,r);if(typeof s!="symbol"){if(Bn(t)){r=Object.freeze(r.concat(t));for(let i=0;ie.replace(/[!,[\]{}]/g,t=>bme[t]);class Lr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Lr.defaultYaml,t),this.tags=Object.assign({},Lr.defaultTags,n)}clone(){const t=new Lr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Lr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Lr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Lr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Lr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Lr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const a=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,a),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Eme(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(t&&r.length>0&&Fn(t.contents)){const i={};Eu(t.contents,(a,o)=>{Fn(o)&&o.tag&&(i[o.tag]=!0)}),s=Object.keys(i)}else s=[];for(const[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(o=>o.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join(` -`)}}Lr.defaultYaml={explicit:!1,version:"1.2"};Lr.defaultTags={"!!":"tag:yaml.org,2002:"};function S6(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function T6(e){const t=new Set;return Eu(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function A6(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function xme(e,t){const n=[],r=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=T6(e));const a=A6(t,s);return s.add(a),a},setAnchors:()=>{for(const i of n){const a=r.get(i);if(typeof a=="object"&&a.anchor&&(rn(a.node)||Bn(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}function oc(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;sPs(r,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!N6(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=i=>{r.res=i,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class v_{constructor(t){Object.defineProperty(this,$s,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!fh(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Ps(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof i=="function"?oc(i,{"":o},"",o):o}}class __ extends v_{constructor(t){super(w_),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],Eu(t,{Node:(i,a)=>{(bu(a)||N6(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let s;for(const i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:i}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(Ps(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=am(s,a,r)),o.count*o.aliasCount>i)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){const s=`*${this.source}`;if(t){if(S6(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${s} `}return s}}function am(e,t,n){if(bu(t)){const r=t.resolve(e),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(Bn(t)){let r=0;for(const s of t.items){const i=am(e,s,n);i>r&&(r=i)}return r}else if(Un(t)){const r=am(e,t.key,n),s=am(e,t.value,n);return Math.max(r,s)}return 1}const C6=e=>!e||typeof e!="function"&&typeof e!="object";class ht extends v_{constructor(t){super(Pi),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ps(this.value,t,n)}toString(){return String(this.value)}}ht.BLOCK_FOLDED="BLOCK_FOLDED";ht.BLOCK_LITERAL="BLOCK_LITERAL";ht.PLAIN="PLAIN";ht.QUOTE_DOUBLE="QUOTE_DOUBLE";ht.QUOTE_SINGLE="QUOTE_SINGLE";const wme="tag:yaml.org,2002:";function vme(e,t,n){if(t){const r=n.filter(i=>i.tag===t),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,e))&&!r.format})}function Df(e,t,n){var f,h,p;if(fh(e)&&(e=e.contents),Fn(e))return e;if(Un(e)){const m=(h=(f=n.schema[to]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:a,sourceObjects:o}=n;let c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=s(e)),new __(c.anchor);c={anchor:null,node:null},o.set(e,c)}t!=null&&t.startsWith("!!")&&(t=wme+t.slice(2));let u=vme(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new ht(e);return c&&(c.node=m),m}u=e instanceof Map?a[to]:Symbol.iterator in Object(e)?a[yu]:a[to]}i&&(i(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new ht(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function bg(e,t,n){let r=n;for(let s=t.length-1;s>=0;--s){const i=t[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return Df(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const pd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class I6 extends v_{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Fn(r)||Un(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(pd(t))this.add(n);else{const[r,...s]=t,i=this.get(r,!0);if(Bn(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,bg(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(Bn(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...s]=t,i=this.get(r,!0);return s.length===0?!n&&rn(i)?i.value:i:Bn(i)?i.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Un(n))return!1;const r=n.value;return r==null||t&&rn(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const s=this.get(n,!0);return Bn(s)?s.hasIn(r):!1}setIn(t,n){const[r,...s]=t;if(s.length===0)this.set(r,n);else{const i=this.get(r,!0);if(Bn(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,bg(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const _me=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function sa(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Uo=(e,t,n)=>e.endsWith(` +- 保持礼貌、专业的语气。`;function jr(){return{name:"",description:lpe,instruction:cpe,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:ope,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:Uc,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const upe=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率"}],dpe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],fpe=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"}];function c6(e){const t=e.tools??[],n=rl.filter(s=>s.toolNames.some(i=>t.includes(i))),r=new Set(n.flatMap(s=>s.toolNames));return{...jr(),name:e.name,description:e.description,instruction:e.instruction||jr().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!r.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(c6)}}function hpe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?c6(e.graph):{...jr(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(r=>r.name))??[]}}function u6(e){return e?1+e.children.reduce((t,n)=>t+u6(n),0):1}function ox(e){return 1+e.subAgents.reduce((t,n)=>t+ox(n),0)}function lx(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function ppe(e){const t=lx(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function mpe(e,t){return e.find(n=>n.kind===t)}const cx=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}];function gpe(e){if(e.status==="success")return cx.length-1;const t=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",部署完成:"complete"}[e.label],n=cx.findIndex(r=>r.phase===t);return n<0?0:n}function ype({task:e}){const t=gpe(e),n=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),r=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return l.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[l.jsxs("div",{className:"aw-deploy-progress-head",children:[l.jsxs("div",{children:[l.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?l.jsx(Kt,{className:"spin"}):e.status==="success"?l.jsx(QL,{}):e.status==="error"?l.jsx(qg,{}):l.jsx(cE,{})}),l.jsxs("div",{children:[l.jsx("h3",{children:r}),l.jsx("p",{children:e.runtimeName})]})]}),l.jsx("strong",{children:e.status==="running"?`${Math.round(n)}%`:e.label})]}),l.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),children:l.jsx("span",{style:{width:`${n}%`}})}),l.jsx("ol",{className:"aw-deploy-steps",children:cx.map((s,i)=>{const a=e.status==="success"||inew Set),[gt,At]=E.useState(()=>new Set),[ut,X]=E.useState(!1),[ne,he]=E.useState(""),[Te,He]=E.useState([]),[qe,Ut]=E.useState([]),[Ye,De]=E.useState(!1),[Be,Ct]=E.useState(""),[un,$t]=E.useState(0),[wn,Fe]=E.useState(!1),[dt,Lt]=E.useState(()=>new Set),[_t,be]=E.useState(!1),[Ve,st]=E.useState(""),[sn,an]=E.useState(""),[Ht,zt]=E.useState(()=>new Set),Bt=E.useRef(!1),qt=E.useRef(""),vn=E.useRef(null),[Xt,Ln]=E.useState(dpe),[Mn,ue]=E.useState("");E.useEffect(()=>{e.length!==0&&Ln(z=>z.map((re,Ee)=>Ee===0&&re.agentIds.length===0?{...re,agentIds:e.slice(0,2).map($=>$.id)}:re))},[e]);const _e=E.useMemo(()=>{const z=new Map;for(const re of e)re.runtimeId&&z.set(re.runtimeId,re);return z},[e]),ve=E.useMemo(()=>{var re;const z=new Map;for(const Ee of t){const $=(re=Ee.deploymentTarget)==null?void 0:re.runtimeId;if(!$||!_e.has($))continue;const le=z.get($);(!le||Ee.updatedAt>le.updatedAt)&&z.set($,Ee)}return z},[_e,t]),ye=E.useMemo(()=>{const z=new Map;for(const re of d){if(!re.runtimeId)continue;const Ee=z.get(re.runtimeId);(!Ee||re.startedAt>Ee.startedAt)&&z.set(re.runtimeId,re)}return z},[d]),nt=E.useMemo(()=>{const z=ce.trim().toLowerCase();return z?e.filter(re=>{const Ee=re.runtimeId?ve.get(re.runtimeId):void 0,$=re.runtimeId?ye.get(re.runtimeId):void 0;return[re.label,re.app,re.host??"",(Ee==null?void 0:Ee.draft.name)??"",(Ee==null?void 0:Ee.draft.description)??"",($==null?void 0:$.runtimeName)??""].join(" ").toLowerCase().includes(z)}):e},[e,ye,ce,ve]),Qe=E.useMemo(()=>{const z=ce.trim().toLowerCase();return t.filter(re=>{var $;const Ee=($=re.deploymentTarget)==null?void 0:$.runtimeId;return Ee&&_e.has(Ee)?!1:z?`${re.draft.name} ${re.draft.description}`.toLowerCase().includes(z):!0})},[_e,t,ce]),ct=E.useMemo(()=>t.filter(z=>{var Ee;const re=(Ee=z.deploymentTarget)==null?void 0:Ee.runtimeId;return!re||!_e.has(re)}).length,[_e,t]),ot=E.useMemo(()=>{const z=ce.trim().toLowerCase();return z?Xt.filter(re=>re.name.toLowerCase().includes(z)):Xt},[Xt,ce]),oe=e.find(z=>z.id===D),Ze=t.find(z=>z.id===M),It=d.find(z=>z.id===U),it=oe!=null&&oe.runtimeId?ve.get(oe.runtimeId):void 0,kt=g?B:D&&s===D?r:null,Ft=E.useMemo(()=>{const z=new Map(e.map((Ee,$)=>[Ee.id,$])),re=new Map(n.map((Ee,$)=>[Ee,$]));return[...nt].sort((Ee,$)=>{const le=Ee.runtimeId?ye.get(Ee.runtimeId):void 0,Re=$.runtimeId?ye.get($.runtimeId):void 0,$e=(le==null?void 0:le.status)==="running"?le.startedAt:0,pt=(Re==null?void 0:Re.status)==="running"?Re.startedAt:0;if($e!==pt)return pt-$e;const at=re.get(Ee.id),lt=re.get($.id);return at!=null&<!=null?at-lt:at!=null?-1:lt!=null?1:(z.get(Ee.id)??0)-(z.get($.id)??0)})},[n,e,nt,ye]),Zn=(oe==null?void 0:oe.label)||(kt==null?void 0:kt.name)||(Ze==null?void 0:Ze.draft.name)||(It==null?void 0:It.runtimeName)||"未选择智能体",or=Xt.find(z=>z.id===Mn),lr=Ft.filter(z=>z.canDelete===!0),dn=Ft.filter(z=>Xe.has(z.id)&&z.canDelete===!0),Zt=Qe.filter(z=>gt.has(z.id)),Yt=lr.length+Qe.length,Jt=dn.length+Zt.length,Mt=E.useMemo(()=>(It==null?void 0:It.agentDraft)??(Ze==null?void 0:Ze.draft)??(it==null?void 0:it.draft)??hpe(kt,(oe==null?void 0:oe.label)??"agent"),[kt,oe==null?void 0:oe.label,it==null?void 0:it.draft,Ze==null?void 0:Ze.draft,It==null?void 0:It.agentDraft]),Cn=E.useMemo(()=>{if(kt)return kt.tools;const z=(Mt.builtinTools??[]).map(re=>{var Ee;return((Ee=rl.find($=>$.id===re))==null?void 0:Ee.label)??re});return Array.from(new Set([...Mt.tools,...z,...(Mt.customTools??[]).map(re=>re.name),...(Mt.mcpTools??[]).map(re=>re.name)].filter(Boolean)))},[Mt,kt]),fn=E.useMemo(()=>kt?kt.skillsPreviewSupported?kt.skills.map(z=>z.name):null:Array.from(new Set([...(Mt.selectedSkills??[]).map(z=>z.name),...Mt.skills].filter(Boolean))),[Mt,kt]),en=E.useMemo(()=>{if(It)return It;if(Ze)return d.filter(z=>{var re,Ee;return((re=z.agentDraft)==null?void 0:re.name)===Ze.draft.name||z.runtimeName===Ze.draft.name||!!((Ee=Ze.deploymentTarget)!=null&&Ee.runtimeId)&&z.runtimeId===Ze.deploymentTarget.runtimeId}).sort((z,re)=>re.startedAt-z.startedAt)[0];if(oe)return d.filter(z=>!!oe.runtimeId&&z.runtimeId===oe.runtimeId||z.runtimeName===oe.label).sort((z,re)=>re.startedAt-z.startedAt)[0]},[d,oe,Ze,It]),Vn=kt?`runtime:${(oe==null?void 0:oe.runtimeId)??kt.name}:${ox(Mt)}`:`draft:${(It==null?void 0:It.id)??(Ze==null?void 0:Ze.id)??(oe==null?void 0:oe.id)??Zn}`,hn=!!(g&&(oe!=null&&oe.runtimeId)&&!Q);E.useEffect(()=>{if(!f)return;const z=d.find(Ee=>Ee.id===f),re=z!=null&&z.runtimeId?_e.get(z.runtimeId):void 0;if(re){I(""),j(""),T(re.id),L("basic");return}T(""),j(""),I(f),L("basic")},[_e,d,f]),E.useEffect(()=>{if(!h){qt.current="";return}const z=`${h}:${p}:${m}`;qt.current!==z&&e.some(re=>re.id===h)&&(qt.current=z,I(""),j(""),T(h),L(p),p==="evaluations"&&(te(m),we("")))},[e,h,p,m]),E.useEffect(()=>{let z=!1;if(ie(null),ee(!g||!(oe!=null&&oe.runtimeId)),!(!g||!(oe!=null&&oe.runtimeId)))return e0(oe.runtimeId,oe.region??"cn-beijing").then(re=>{z||ie(re)}).catch(()=>{z||ie(null)}).finally(()=>{z||ee(!0)}),()=>{z=!0}},[g,oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{let z=!1;if(W(null),!!(oe!=null&&oe.runtimeId))return hv(oe.runtimeId,oe.region??"cn-beijing").then(re=>{z||W(re)}).catch(()=>{z||W(null)}),()=>{z=!0}},[oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{let z=!1;if(He([]),Ut([]),Ct(""),q!=="evaluations"||!(oe!=null&&oe.runtimeId)){De(!1);return}return De(!0),yM({runtimeId:oe.runtimeId,region:oe.region??"cn-beijing",appName:oe.app,pageSize:100}).then(re=>{z||(Ut(re.sets),He(re.items.map(Ee=>({...Ee,tag:Ee.kind==="good"?"Good case":"Bad case"})).sort((Ee,$)=>lx($.createdAt)-lx(Ee.createdAt))))}).catch(re=>{z||Ct(re instanceof Error?re.message:String(re))}).finally(()=>{z||De(!1)}),()=>{z=!0}},[un,q,oe==null?void 0:oe.app,oe==null?void 0:oe.region,oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{const z=new Set(Te.map(re=>re.id));Lt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee}),zt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee}),sn&&!z.has(sn)&&an("")},[Te,sn]),E.useEffect(()=>{Fe(!1),Lt(new Set),zt(new Set),st(""),an("")},[oe==null?void 0:oe.runtimeId]),E.useEffect(()=>{const z=new Set(Ft.filter(re=>re.canDelete===!0).map(re=>re.id));xt(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee})},[Ft]),E.useEffect(()=>{const z=new Set(Qe.map(re=>re.id));At(re=>{const Ee=new Set([...re].filter($=>z.has($)));return Ee.size===re.size?re:Ee})},[Qe]);const gr=oe!=null&&oe.runtimeId?Te:upe,Kn=gr.filter(z=>{if(z.kind!==fe)return!1;const re=ge.trim().toLowerCase();return re?[z.input,z.output,z.referenceOutput,z.comment,z.tag??"",z.sessionId,z.messageId,z.userId,z.evaluationSetName].join(" ").toLowerCase().includes(re):!0}),bs=Kn.filter(z=>dt.has(z.id)),yr=!!(oe!=null&&oe.runtimeId),es=z=>{te(z),we(""),st("");const re=gr.find(Ee=>Ee.kind===z);an((re==null?void 0:re.id)??""),window.setTimeout(()=>{var Ee;(Ee=vn.current)==null||Ee.scrollIntoView({behavior:"smooth",block:"start"})},0)},Es=z=>{st(""),Lt(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee})},bi=()=>{st(""),Lt(new Set(Kn.map(z=>z.id)))},po=()=>{st(""),Lt(new Set),Fe(!1)},xs=z=>{zt(re=>{const Ee=new Set(re);return Ee.has(z)?Ee.delete(z):Ee.add(z),Ee})},Ei=z=>{an(z.id),st(""),!(!z.sessionId||!z.messageId)&&(N==null||N(z))},$i=async z=>{if(!(oe!=null&&oe.runtimeId)||_t||z.length===0)return;const re=z.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${z.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(re))return;const Ee=z.map(le=>le.id),$=new Set(Ee);be(!0),st("");try{await bM({runtimeId:oe.runtimeId,region:oe.region??"cn-beijing",appName:oe.app,itemIds:Ee});const le=new Map;for(const Re of z)le.set(Re.kind,(le.get(Re.kind)??0)+1);He(Re=>Re.filter($e=>!$.has($e.id))),Ut(Re=>Re.map($e=>({...$e,itemCount:Math.max(0,$e.itemCount-(le.get($e.kind)??0))}))),Lt(Re=>new Set([...Re].filter($e=>!$.has($e)))),zt(Re=>new Set([...Re].filter($e=>!$.has($e)))),sn&&$.has(sn)&&an(""),z.length>1&&Fe(!1),A==null||A(z)}catch(le){st(le instanceof Error?le.message:String(le))}finally{be(!1)}},Ur=z=>{Ln(re=>re.map(Ee=>Ee.id===z.id?z:Ee))},Ar=()=>{const z=new Set(e.map($=>$.id)),re=n.filter($=>z.has($)),Ee=new Set(re);return[...re,...e.filter($=>!Ee.has($.id)).map($=>$.id)]},Jn=(z,re,Ee)=>{if(!y||z===re)return;const $=Ar().filter($e=>$e!==z),le=$.indexOf(re),Re=le<0?$.length:Ee==="after"?le+1:le;$.splice(Re,0,z),y($)},Ea=(z,re)=>{if(!Z||Z===re)return;const Ee=z.currentTarget.getBoundingClientRect();Ie(re),Ce(z.clientY>Ee.top+Ee.height/2?"after":"before")},Hi=(z,re)=>{if(!y)return;const Ee=Ar(),$=Ee.indexOf(z),le=Math.max(0,Math.min(Ee.length-1,$+re));$<0||$===le||(Ee.splice($,1),Ee.splice(le,0,z),y(Ee))},wl=z=>{z.canDelete===!0&&(he(""),xt(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee}))},vl=z=>{he(""),At(re=>{const Ee=new Set(re);return Ee.has(z.id)?Ee.delete(z.id):Ee.add(z.id),Ee})},xa=()=>{he(""),xt(new Set(lr.map(z=>z.id))),At(new Set(Qe.map(z=>z.id)))},wa=()=>{he(""),xt(new Set),At(new Set),Ge(!1)},va=async()=>{if(Jt===0||ut)return;const z=dn.length,re=Zt.length,Ee=z===1&&re===0?`确定删除 Agent "${dn[0].label}"?该 Runtime 将被永久删除。`:z===0&&re===1?`确定删除草稿 "${Zt[0].draft.name||"未命名 Agent"}"?`:`确定删除选中的 ${Jt} 个项目?${z>0?`${z} 个 Runtime 将被永久删除。`:""}`;if(window.confirm(Ee)){X(!0),he("");try{if(dn.length>0){if(!w)throw new Error("当前页面不支持删除已部署 Agent。");await w(dn)}Zt.length>0&&(b==null||b(Zt)),xt(new Set),At(new Set),Ge(!1),dn.some($=>$.id===D)&&T(""),Zt.some($=>$.id===M)&&j("")}catch($){he($ instanceof Error?$.message:String($))}finally{X(!1)}}},mo=async z=>{if(!(!w||z.canDelete!==!0||ut)&&window.confirm(`确定删除 Agent "${z.label}"?该 Runtime 将被永久删除。`)){X(!0),he("");try{await w([z]),D===z.id&&T("")}catch(re){he(re instanceof Error?re.message:String(re))}finally{X(!1)}}},_a=z=>{if(!b||ut)return;const re=z.draft.name||"未命名 Agent";window.confirm(`确定删除草稿 "${re}"?`)&&(he(""),b([z]),M===z.id&&j(""))},Vs=()=>{const z=`eval-${Date.now()}`,re={id:z,name:`新评测组 ${Xt.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Ln(Ee=>[re,...Ee]),ue(z)},vt=z=>{Ur({...z,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+z.history.length%7,status:"completed"},...z.history]})};return l.jsxs("div",{className:`aw-root${g?" is-detail-only":""}`,children:[l.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[l.jsx("button",{type:"button",className:O==="library"?"is-active":"","aria-pressed":O==="library",onClick:()=>{F("library"),J("")},children:"智能体库"}),l.jsx("button",{type:"button",className:O==="evaluation"?"is-active":"","aria-pressed":O==="evaluation",onClick:()=>{F("evaluation"),J("")},children:"评测"})]}),l.jsxs("div",{className:"aw-workspace-frame",children:[l.jsxs("div",{className:"aw-workspace","aria-hidden":O==="evaluation"||void 0,ref:z=>z==null?void 0:z.toggleAttribute("inert",O==="evaluation"),children:[l.jsxs("aside",{className:"aw-sidebar","aria-label":O==="library"?"智能体列表":"评测组列表",children:[l.jsxs("label",{className:"aw-search",children:[l.jsx(yf,{"aria-hidden":!0}),l.jsx("input",{value:ce,onChange:z=>J(z.currentTarget.value),placeholder:O==="library"?"搜索智能体":"搜索评测组","aria-label":O==="library"?"搜索智能体":"搜索评测组"})]}),l.jsxs("button",{type:"button",className:"aw-create-card",onClick:O==="library"?S:Vs,disabled:O==="library"&&!a,children:[l.jsx(ir,{"aria-hidden":!0}),l.jsx("span",{children:O==="library"?"新建 Agent":"新建评测组"})]}),O==="library"&&(w||b)&&l.jsx("div",{className:`aw-selection-toolbar${et?" is-active":""}`,children:et?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"aw-selection-count",children:["已选 ",Jt," 个"]}),l.jsx("button",{type:"button",onClick:xa,disabled:Yt===0||ut,children:"全选"}),l.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void va(),disabled:Jt===0||ut,children:ut?"删除中…":"删除所选"}),l.jsx("button",{type:"button",onClick:wa,disabled:ut,children:"取消"})]}):l.jsx("button",{type:"button",onClick:()=>{he(""),Ge(!0)},disabled:Yt===0,children:"选择"})}),O==="library"&&ne&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:ne}),l.jsx("div",{className:"aw-agent-list",children:O==="evaluation"?ot.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):ot.map(z=>l.jsxs("button",{type:"button",className:`aw-agent-item${z.id===Mn?" is-active":""}`,onClick:()=>ue(z.id),children:[l.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[l.jsx("strong",{children:z.name}),l.jsxs("small",{children:[z.agentIds.length," 个智能体 · ",z.history.length," 次运行"]})]}),l.jsx(Id,{"aria-hidden":!0})]},z.id)):c&&Ft.length===0&&Qe.length===0?l.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&Ft.length===0&&Qe.length===0?l.jsxs("div",{className:"aw-list-empty aw-list-error",children:[l.jsx("span",{children:u}),x&&l.jsx("button",{type:"button",onClick:x,children:"重试"})]}):Ft.length===0&&Qe.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):l.jsxs(l.Fragment,{children:[Qe.map(z=>{const re=d.filter($=>{var le,Re;return((le=$.agentDraft)==null?void 0:le.name)===z.draft.name||$.runtimeName===z.draft.name||!!((Re=z.deploymentTarget)!=null&&Re.runtimeId)&&$.runtimeId===z.deploymentTarget.runtimeId}).sort(($,le)=>le.startedAt-$.startedAt)[0],Ee=gt.has(z.id);return l.jsxs("button",{type:"button",className:["aw-agent-item",et?"is-selecting":"",Ee?"is-selected-for-delete":"",z.id===M?"is-active":""].filter(Boolean).join(" "),"aria-pressed":et?Ee:void 0,onClick:()=>{if(et){vl(z);return}T(""),I(""),j(z.id),L("basic")},children:[et&&l.jsx("span",{className:`aw-select-marker${Ee?" is-checked":""}`,"aria-hidden":"true"}),l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:z.draft.name||"未命名 Agent"}),l.jsx("span",{className:`aw-draft-badge${(re==null?void 0:re.status)==="running"?" is-deploying":""}`,children:(re==null?void 0:re.status)==="running"?"部署中":"草稿"})]}),l.jsx("small",{children:z.deploymentTarget?"待更新":"尚未发布"})]}),l.jsx(Id,{"aria-hidden":!0})]},z.id)}),Ft.map(z=>{const re=z.runtimeId?ye.get(z.runtimeId):void 0,Ee=z.runtimeId?ve.get(z.runtimeId):void 0,$=Xe.has(z.id),le=z.canDelete===!0,Re=(re==null?void 0:re.status)==="running"?{label:"部署中",className:" is-deploying"}:(re==null?void 0:re.status)==="error"?{label:"失败",className:" is-error"}:(re==null?void 0:re.status)==="cancelled"?{label:"已取消",className:" is-muted"}:Ee?{label:"待更新",className:""}:null,$e=(re==null?void 0:re.status)==="running"?"正在更新部署":Ee?"待更新":z.remote?z.host||"远程智能体":"本地智能体",pt=["aw-agent-item","aw-agent-item--sortable",z.id===D?"is-active":"",et?"is-selecting":"",$?"is-selected-for-delete":"",et&&!le?"is-selection-disabled":"",z.id===Z?"is-dragging":"",z.id===Ne&&z.id!==Z?`is-drop-target is-drop-${We}`:""].filter(Boolean).join(" ");return l.jsxs("button",{type:"button",draggable:!!y&&!et,className:pt,"aria-pressed":et?$:void 0,"aria-keyshortcuts":y?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:at=>{y&&(Bt.current=!0,me(z.id),at.dataTransfer.effectAllowed="move",at.dataTransfer.setData("text/plain",z.id))},onDragEnter:at=>{Ea(at,z.id)},onDragOver:at=>{!Z||Z===z.id||(at.preventDefault(),at.dataTransfer.dropEffect="move",Ea(at,z.id))},onDragLeave:at=>{const lt=at.relatedTarget;lt instanceof Node&&at.currentTarget.contains(lt)||Ne===z.id&&Ie("")},onDrop:at=>{at.preventDefault();const lt=at.dataTransfer.getData("text/plain")||Z;Jn(lt,z.id,We),me(""),Ie(""),Ce("before")},onDragEnd:()=>{me(""),Ie(""),Ce("before"),window.setTimeout(()=>{Bt.current=!1},0)},onKeyDown:at=>{at.altKey&&(at.key==="ArrowUp"?(at.preventDefault(),Hi(z.id,-1)):at.key==="ArrowDown"&&(at.preventDefault(),Hi(z.id,1)))},onClick:at=>{if(et){at.preventDefault(),wl(z);return}if(Bt.current){at.preventDefault(),Bt.current=!1;return}I(""),j(""),T(z.id),L("basic"),_(z.id)},children:[et&&l.jsx("span",{className:`aw-select-marker${$?" is-checked":""}`,"aria-hidden":"true"}),l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:z.label}),z.currentVersion!=null&&l.jsxs("span",{className:"aw-version-badge",children:["v",z.currentVersion]}),Re&&l.jsx("span",{className:`aw-draft-badge${Re.className}`,children:Re.label})]}),l.jsx("small",{children:$e})]}),l.jsx(Id,{"aria-hidden":!0})]},z.id)})]})}),l.jsxs("div",{className:"aw-list-count",children:["共 ",O==="library"?e.length+ct:Xt.length," 个"]})]}),O==="evaluation"&&or?l.jsx(xpe,{group:or,agents:e,cases:gr,onChange:Ur,onRun:vt}):O==="evaluation"?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择评测组"})}):!oe&&!Ze&&!It?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择智能体"})}):l.jsxs("main",{className:"aw-main",children:[oe&&!kt&&(i||g&&!Q)&&l.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:l.jsxs("div",{className:"aw-detail-loading-card",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsxs("span",{children:[l.jsx("strong",{children:"正在加载智能体"}),l.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),l.jsxs("div",{className:"aw-agent-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:Zn}),(oe==null?void 0:oe.currentVersion)!=null&&l.jsxs("span",{children:["v",oe.currentVersion]}),Ze&&l.jsx("span",{children:"草稿"}),it&&l.jsx("span",{children:"待更新"}),!oe&&!Ze&&It&&l.jsx("span",{children:It.label})]}),l.jsx("p",{children:Mt.description||(i?"正在读取智能体信息…":"暂无描述")})]}),((oe==null?void 0:oe.canDelete)||Ze||it)&&l.jsxs("div",{className:"aw-head-actions",children:[(Ze||it)&&l.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const z=Ze??it;z&&_a(z)},disabled:ut,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(oe==null?void 0:oe.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void mo(oe),disabled:ut,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:ut?"删除中…":"删除 Agent"})]})]})]}),en&&en.status!=="success"&&l.jsx("div",{className:"aw-detail-deployment",children:l.jsx(ype,{task:en})}),l.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",children:fpe.map(z=>l.jsx("button",{type:"button",className:q===z.id?"is-active":"","aria-pressed":q===z.id,onClick:()=>L(z.id),children:z.label},z.id))}),l.jsxs("div",{className:"aw-content",children:[q==="basic"&&l.jsxs("div",{className:"aw-basic-stack",children:[l.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"部署配置"}),l.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),l.jsxs("dl",{className:"aw-readonly-config",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"运行状态"}),l.jsxs("dd",{className:(K==null?void 0:K.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(K==null?void 0:K.status.toLowerCase())==="ready"&&l.jsx("span",{className:"aw-status-dot"}),(K==null?void 0:K.status)||"读取中…"]})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署区域"}),l.jsx("dd",{children:(K==null?void 0:K.region)||(oe==null?void 0:oe.region)||(en==null?void 0:en.region)||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"网络访问"}),l.jsx("dd",{children:K!=null&&K.networkTypes.length?K.networkTypes.join(" / "):"暂未提供"})]})]})]}),l.jsxs("section",{className:"aw-canvas-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"执行流程"})}),l.jsx("div",{className:"aw-canvas",children:hn?l.jsxs("div",{className:"aw-canvas-loading",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsx("span",{children:"正在加载执行流程"})]}):l.jsx(yg,{draft:Mt,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Vn)})]}),l.jsxs("section",{className:"aw-details-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"详细信息"})}),l.jsxs("dl",{className:"aw-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:(kt==null?void 0:kt.model)||Mt.modelName||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"智能体数量"}),l.jsx("dd",{children:kt!=null&&kt.graph?u6(kt.graph):ox(Mt)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"工具"}),l.jsx("dd",{className:"aw-fact-badges",children:Cn.length?Cn.map(z=>l.jsx("span",{children:z},z)):"暂无"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能"}),l.jsx("dd",{className:"aw-fact-badges",children:fn===null?"暂不支持预览":fn.length?fn.map(z=>l.jsx("span",{children:z},z)):"暂无"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:(K==null?void 0:K.currentVersion)!=null?`v${K.currentVersion}`:(oe==null?void 0:oe.currentVersion)!=null?`v${oe.currentVersion}`:"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:Ze?"草稿":(en==null?void 0:en.status)==="error"?"部署失败":(en==null?void 0:en.status)==="cancelled"?"已取消":it?"待更新":l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),l.jsxs("section",{className:"aw-option-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"优化项"}),l.jsx("p",{children:"针对运行质量开启专项优化策略。"})]})}),l.jsxs("div",{className:"aw-option-content",children:[l.jsx("div",{className:"aw-option-list","aria-disabled":"true",children:[["上下文优化","压缩冗余信息,保留对当前任务最有价值的上下文。"],["幻觉抑制","在证据不足时降低确定性表达并主动请求补充信息。"],["工具调用优化","减少重复调用,并优先复用已经获得的结果。"]].map(([z,re])=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",disabled:!0}),l.jsxs("span",{children:[l.jsx("strong",{children:z}),l.jsx("small",{children:re})]})]},z))}),l.jsx("div",{className:"aw-option-glass",role:"status",children:l.jsx("span",{children:"暂未开放"})})]})]})]}),q==="evaluations"&&l.jsxs("section",{className:"aw-cases",children:[oe!=null&&oe.runtimeId?l.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(z=>{const re=mpe(qe,z),Ee=(re==null?void 0:re.itemCount)??Te.filter($=>$.kind===z).length;return l.jsxs("button",{type:"button",onClick:()=>es(z),children:[l.jsx("strong",{children:Ee}),l.jsx("span",{children:z==="good"?"Good cases":"Bad cases"})]},z)})}):l.jsx("div",{className:"aw-case-note",children:"只有已部署到 AgentKit Runtime 的 Agent 会同步展示用户反馈评测集。"}),l.jsx("div",{className:"aw-case-filters",children:["good","bad"].map(z=>l.jsx("button",{type:"button",className:fe===z?"is-active":"","aria-pressed":fe===z,onClick:()=>te(z),children:z==="good"?"Good case":"Bad case"},z))}),l.jsxs("label",{className:"aw-case-search",children:[l.jsx(yf,{"aria-hidden":!0}),l.jsx("input",{type:"search",value:ge,onChange:z=>we(z.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]}),yr&&l.jsx("div",{className:`aw-case-toolbar${wn?" is-active":""}`,children:wn?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"aw-selection-count",children:["已选 ",bs.length," 条"]}),l.jsx("button",{type:"button",onClick:bi,disabled:Kn.length===0||_t,children:"全选当前"}),l.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void $i(bs),disabled:bs.length===0||_t,children:_t?"删除中…":"删除所选"}),l.jsx("button",{type:"button",onClick:po,disabled:_t,children:"取消"})]}):l.jsx("button",{type:"button",onClick:()=>{st(""),Fe(!0)},disabled:Kn.length===0||_t,children:"选择案例"})}),Ve&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:Ve}),l.jsx("div",{ref:vn,children:l.jsx(Epe,{cases:Kn,loading:Ye,error:Be,runtimeBacked:!!(oe!=null&&oe.runtimeId),selectionMode:wn,selectedCaseIds:dt,focusedCaseId:sn,expandedCaseIds:Ht,deleting:_t,canDelete:yr,onOpenCase:Ei,onToggleCase:Es,onToggleExpanded:xs,onDeleteCase:z=>void $i([z]),onRetry:()=>$t(z=>z+1)})})]})]}),q==="basic"&&(oe||Ze)&&l.jsxs("div",{className:"aw-basic-actions",children:[oe&&l.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>k==null?void 0:k(oe.id),children:[l.jsx(Tz,{"aria-hidden":!0}),l.jsx("span",{children:"去对话"})]}),l.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:Ze||it?!a:!(oe!=null&&oe.runtimeId)||!o||!i&&!kt,onClick:()=>Ze?R==null?void 0:R(Ze):it?R==null?void 0:R(it):C(Mt),children:Ze||it?"继续编辑":"更新"}),(Ze||it)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>{const z=Ze??it;z&&_a(z)},disabled:ut,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(oe==null?void 0:oe.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>void mo(oe),disabled:ut,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(js,{"aria-hidden":!0}),l.jsx("span",{children:ut?"删除中…":"删除 Agent"})]})]})]})]}),O==="evaluation"&&l.jsx("div",{className:"aw-evaluation-glass",role:"status",children:l.jsx("span",{children:"敬请期待"})})]})]})}function Epe({cases:e,loading:t=!1,error:n="",runtimeBacked:r=!1,selectionMode:s=!1,selectedCaseIds:i,focusedCaseId:a="",expandedCaseIds:o,deleting:c=!1,canDelete:u=!1,onOpenCase:d,onToggleCase:f,onToggleExpanded:h,onDeleteCase:p,onRetry:m}){return l.jsxs("div",{className:"aw-case-table",children:[l.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[l.jsx("span",{children:"用户输入"}),l.jsx("span",{children:"Agent 输出"}),l.jsx("span",{children:"来源"})]}),t?l.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?l.jsxs("div",{className:"aw-case-empty aw-case-error",children:[l.jsx("span",{children:n}),m&&l.jsx("button",{type:"button",onClick:m,children:"重试"})]}):e.length===0?l.jsx("div",{className:"aw-case-empty",children:r?"暂无用户反馈案例":"没有匹配的案例"}):e.map(g=>{const x=(i==null?void 0:i.has(g.id))??!1,y=(o==null?void 0:o.has(g.id))??!1,b=g.output.length+g.referenceOutput.length>220;return l.jsxs("div",{className:["aw-case-row",a===g.id?"is-focused":"",s?"is-selecting":"",x?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?x:void 0,onClick:()=>{if(s){f==null||f(g);return}d==null||d(g)},onKeyDown:_=>{_.target===_.currentTarget&&(_.key!=="Enter"&&_.key!==" "||(_.preventDefault(),s?f==null||f(g):d==null||d(g)))},children:[l.jsxs("div",{className:"aw-case-text",children:[l.jsxs("span",{className:"aw-case-title-line",children:[s&&l.jsx("span",{className:`aw-select-marker${x?" is-checked":""}`,"aria-hidden":"true"}),l.jsx("strong",{title:g.input,children:g.input||"无用户输入"})]}),g.comment&&l.jsxs("small",{title:g.comment,children:["备注:",g.comment]})]}),l.jsxs("div",{className:`aw-case-output${y?" is-expanded":""}`,children:[l.jsx("p",{className:"aw-case-output-preview",title:g.output,children:g.output||"无可见回复"}),g.referenceOutput&&l.jsxs("small",{className:"aw-case-output-preview",title:g.referenceOutput,children:["Reference: ",g.referenceOutput]}),b&&l.jsx("button",{type:"button",className:"aw-case-expand",onClick:_=>{_.stopPropagation(),h==null||h(g.id)},children:y?"收起":"展开"})]}),l.jsxs("div",{className:"aw-case-meta",children:[l.jsxs("span",{className:"aw-case-meta-top",children:[l.jsx("span",{className:`aw-case-tag is-${g.kind}`,children:g.kind==="good"?"Good case":"Bad case"}),u&&l.jsx("button",{type:"button",className:"aw-case-delete",onClick:_=>{_.stopPropagation(),p==null||p(g)},disabled:c,title:"删除反馈案例","aria-label":"删除反馈案例",children:l.jsx(js,{"aria-hidden":!0})})]}),l.jsx("small",{children:ppe(g.createdAt)}),(g.userId||g.sessionId)&&l.jsx("small",{title:[g.userId,g.sessionId].filter(Boolean).join(" · "),children:[g.userId,g.sessionId].filter(Boolean).join(" · ")})]})]},g.id)})]})}function xpe({group:e,agents:t,cases:n,onChange:r,onRun:s}){const[i,a]=E.useState("config"),o=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];E.useEffect(()=>a("config"),[e.id]);const u=f=>{r({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{r({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return l.jsxs("main",{className:"aw-main",children:[l.jsxs("div",{className:"aw-eval-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:e.name}),l.jsx("span",{children:"评测组"})]}),l.jsxs("p",{children:[o.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),l.jsxs("button",{type:"button",className:"aw-run",onClick:()=>s(e),disabled:!0,children:[l.jsx(gz,{"aria-hidden":!0}),"开始评测"]})]}),l.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[l.jsx("button",{type:"button",className:i==="config"?"is-active":"","aria-pressed":i==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),l.jsx("button",{type:"button",className:i==="history"?"is-active":"","aria-pressed":i==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),l.jsx("div",{className:"aw-content",children:i==="config"?l.jsxs("div",{className:"aw-eval-setup",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"参评智能体"}),l.jsxs("span",{children:["已选择 ",o.length," 个"]})]}),l.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),l.jsxs("span",{children:[l.jsx("strong",{children:f.label}),l.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),l.jsxs("div",{className:"aw-eval-setting-grid",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"评测资源"})}),l.jsxs("div",{className:"aw-eval-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"评测集"}),l.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[l.jsx("option",{children:"核心回归集"}),l.jsx("option",{children:"安全边界集"}),l.jsx("option",{children:"工具调用集"})]}),l.jsxs("small",{children:[n.length," 条案例"]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"评估器"}),l.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[l.jsx("option",{children:"综合质量评估器"}),l.jsx("option",{children:"事实一致性评估器"}),l.jsx("option",{children:"工具调用评估器"})]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"并发数"}),l.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[l.jsx("option",{value:"2",children:"2"}),l.jsx("option",{value:"4",children:"4"}),l.jsx("option",{value:"8",children:"8"})]})]})]})]}),l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"评测指标"}),l.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),l.jsx("div",{className:"aw-metric-list",children:c.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),l.jsx("span",{children:f})]},f))})]})]})]}):l.jsxs("section",{className:"aw-eval-history",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"历史结果"}),l.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?l.jsxs("div",{className:"aw-results-empty",children:[l.jsx("strong",{children:"暂无历史结果"}),l.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):l.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>l.jsxs("button",{type:"button",children:[l.jsxs("span",{children:[l.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),l.jsxs("small",{children:[f.createdAt," · ",o.length," 个智能体"]})]}),l.jsxs("span",{className:"aw-history-score",children:[l.jsx("strong",{children:f.score}),l.jsx("small",{children:"综合得分"})]}),l.jsxs("span",{className:"aw-complete",children:[l.jsx(pi,{}),"已完成"]}),l.jsx(Id,{"aria-hidden":!0})]},f.id))})]})})]})}const lC=2,wpe=174,cC=12;function d6(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t).replace(/\//g,"-")}function vpe(e){return{id:e.runtimeId,name:e.name,description:e.name,toolCount:0,skillCount:0,createdAt:d6(e.createdAt??""),runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}async function _pe(e,t,n){const r=await bc({scope:"mine",region:"all",pageSize:t,nextToken:e});return n(r.runtimes.map(vpe)),Promise.all(r.runtimes.map(async s=>{try{const i=await e0(s.runtimeId,s.region),a={id:s.runtimeId,name:i.name||s.name,description:i.description||s.name,toolCount:i.tools.length,skillCount:i.skills.length,createdAt:d6(s.createdAt??""),runtime:{runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion,canDelete:s.canDelete}};n([a])}catch{}})),{nextToken:r.nextToken,count:r.runtimes.length}}function kpe({agent:e,onUse:t,onViewDetails:n,connecting:r,connected:s}){return l.jsxs("article",{className:"my-agent-card",children:[l.jsxs("div",{className:"my-agent-card-content",children:[l.jsx("h3",{children:e.name}),l.jsx("p",{className:"my-agent-description",children:e.description}),l.jsxs("dl",{className:"my-agent-meta",children:[l.jsxs("div",{className:"my-agent-label",children:[l.jsx("dt",{children:"工具"}),l.jsxs("dd",{children:[e.toolCount," 个"]})]}),l.jsxs("div",{className:"my-agent-label",children:[l.jsx("dt",{children:"技能"}),l.jsxs("dd",{children:[e.skillCount," 个"]})]}),l.jsxs("div",{className:"my-agent-created-at",children:[l.jsx("dt",{children:"创建时间"}),l.jsx("dd",{children:e.createdAt})]})]})]}),l.jsxs("div",{className:"my-agent-actions",children:[l.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!e.runtime||r||s,"aria-busy":r||void 0,onClick:()=>void(t==null?void 0:t(e)),children:r?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),l.jsx("span",{children:"连接中"})]}):s?"已连接":"使用"}),l.jsx("button",{type:"button",className:"my-agent-details",disabled:!e.runtime,onClick:()=>n==null?void 0:n(e),children:"查看详情"})]})]})}function Npe({section:e,onCreateAgent:t,onUseAgent:n,onViewAgentDetails:r,connectingAgentId:s,connectedRuntimeId:i,loading:a,serverPagination:o,onPageSizeChange:c,comingSoon:u}){const d=E.useRef(null),[f,h]=E.useState(1),[p,m]=E.useState(1),g=Math.max(1,f*lC-1),x=Math.max(1,Math.ceil(e.agents.length/g)),y=E.useMemo(()=>o?e.agents:e.agents.slice((p-1)*g,p*g),[p,g,e.agents,o]),w=(o==null?void 0:o.page)??p;return E.useEffect(()=>{const b=d.current;if(!b)return;const _=()=>{const N=b.getBoundingClientRect().width,A=Math.max(1,Math.floor((N+cC)/(wpe+cC)));h(A),c==null||c(Math.max(1,A*lC-1))};_();const k=new ResizeObserver(_);return k.observe(b),()=>k.disconnect()},[c]),E.useEffect(()=>{m(b=>Math.min(b,x))},[x]),l.jsxs("section",{className:"my-agents-section",children:[l.jsx("h2",{children:e.title}),l.jsxs("div",{className:"my-agent-section-content",children:[l.jsxs("div",{className:"my-agent-grid",ref:d,children:[l.jsxs("button",{type:"button",className:"my-agent-add","aria-label":`添加${e.title}`,disabled:!t||u,onClick:t,children:[l.jsx(ir,{"aria-hidden":"true"}),l.jsx("span",{children:"添加智能体"})]}),y.map(b=>{var _;return l.jsx(kpe,{agent:b,onUse:n,onViewDetails:r,connecting:b.id===s,connected:((_=b.runtime)==null?void 0:_.runtimeId)===i},b.id)}),a&&l.jsxs("div",{className:"my-agent-loading",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),l.jsx("span",{children:"加载中"})]})]}),l.jsxs("nav",{className:"my-agent-pagination","aria-label":`${e.title}分页`,children:[l.jsx("button",{type:"button","aria-label":"上一页",disabled:w===1||a,onClick:(o==null?void 0:o.onPrevious)??(()=>m(p-1)),children:"‹"}),l.jsx("span",{children:o?w:`${p} / ${x}`}),l.jsx("button",{type:"button","aria-label":"下一页",disabled:a||(o?!o.hasNext:p===x),onClick:(o==null?void 0:o.onNext)??(()=>m(p+1)),children:"›"})]}),u&&l.jsx("div",{className:"my-agent-coming-soon-overlay",role:"status",children:"敬请期待"})]})]})}function Spe({onCreateAgent:e,onCreateCodexAgent:t,onUseAgent:n,onViewAgentDetails:r,connectedRuntimeId:s=""}){const[i,a]=E.useState([]),[o,c]=E.useState(!0),[u,d]=E.useState(1),[f,h]=E.useState(""),[p,m]=E.useState(0),[g,x]=E.useState(""),y=E.useRef(0),w=E.useRef([""]),b=E.useRef(0),_=E.useCallback(O=>{y.current!==O&&(y.current=O,m(O))},[]),k=E.useCallback((O,F,q)=>{const L=++b.current;return c(!0),_pe(F,q,D=>{b.current===L&&(O>1&&D.length===0||a(T=>D.length!==1||T.length===0?D:T.map(M=>M.id===D[0].id?D[0]:M)))}).then(({nextToken:D,count:T})=>{if(b.current===L){if(O>1&&T===0){h("");return}d(O),h(D)}}).catch(()=>{b.current}).finally(()=>{b.current===L&&c(!1)})},[]);E.useEffect(()=>{if(p!==0)return w.current=[""],h(""),k(1,"",p),()=>{b.current+=1}},[k,p]);const N=()=>{f&&(w.current[u]=f,k(u+1,f,p))},A=()=>{if(u<=1)return;const O=u-1,F=w.current[O-1]??"";k(O,F,p)},S=E.useCallback(async O=>{if(!g){x(O.id);try{await new Promise(F=>requestAnimationFrame(()=>F())),await n(O)}finally{x("")}}},[g,n]),C=E.useMemo(()=>[{title:"通用智能体",agents:i},{title:"Codex 智能体",agents:[]},{title:"OpenClaw 智能体",agents:[],comingSoon:!0},{title:"Hermes 智能体",agents:[],comingSoon:!0}],[i]),R=[e,t,void 0,void 0];return l.jsxs("div",{className:"my-agents-page",children:[!s&&l.jsx("div",{className:"my-agents-connect-banner",role:"status",children:"请选择一个智能体以对话"}),C.map((O,F)=>l.jsx(Npe,{section:O,onCreateAgent:R[F],onUseAgent:S,onViewAgentDetails:r,connectingAgentId:g,connectedRuntimeId:s,loading:F===0&&o,onPageSizeChange:F===0?_:void 0,serverPagination:F===0?{page:u,hasNext:!!f,onPrevious:A,onNext:N}:void 0,comingSoon:O.comingSoon},O.title))]})}const Tpe={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function Ape(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function Cpe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function Ipe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function m_(e,t){if(Cpe(e))return Ape(t,e.path);if(Ipe(e)){const n=Tpe[e.call],r={};for(const[s,i]of Object.entries(e.args??{}))r[s]=m_(i,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function Rpe(e,t){const n=m_(e,t);return n==null?"":typeof n=="string"?n:String(n)}const f6=new Map;function El(e,t){f6.set(e,t)}function Ope(e){return f6.get(e)}function Lpe(e,t,n){const r=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let i=0;im_(r,e.dataModel),resolveString:r=>Rpe(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const s=e.components[r];if(!s)return null;const i=Ope(s.component)??Mpe;return l.jsx(i,{node:s,ctx:n},r)}};return l.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function Dpe(e){const t=E.useRef(null),n=E.useRef(!0),r=28,s=E.useCallback(()=>{const i=t.current;i&&(n.current=i.scrollHeight-i.scrollTop-i.clientHeight{const i=t.current;i&&n.current&&(i.scrollTop=i.scrollHeight)},[e]),{ref:t,onScroll:s}}function g_({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:l.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>l.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[l.jsx(nl,{"aria-hidden":!0}),l.jsxs("span",{children:["/",r.name]}),t?l.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:l.jsx(Zr,{})}):null]},r.name)),e.targetAgent?l.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[l.jsx(qL,{"aria-hidden":!0}),l.jsx("span",{children:e.targetAgent.name}),n?l.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:l.jsx(Zr,{})}):null]}):null]})}function y_(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function p6(e){var n,r,s,i;const t=y_(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((i=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:i.toUpperCase())??"IMAGE":"TXT"}function m6(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function g6(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?wM(t,e.uri):""}function Ppe({kind:e}){return e==="image"?l.jsx(nM,{}):e==="video"?l.jsx(eM,{}):e==="pdf"?l.jsx(pz,{}):l.jsx(JL,{})}function b_({appName:e,items:t,compact:n=!1,onRemove:r}){const[s,i]=E.useState(null);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=y_(a.mimeType),c=g6(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=l.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>i(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&c?l.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):o==="video"&&c?l.jsxs("div",{className:"media-card-video-container",children:[l.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),l.jsx("span",{className:"media-card-video-play",children:l.jsx(Mz,{})})]}):l.jsx("span",{className:"media-card-icon",children:l.jsx(Ppe,{kind:o})}),l.jsxs("span",{className:"media-card-copy",children:[l.jsx("span",{className:"media-card-name",children:a.name??"附件"}),l.jsxs("span",{className:"media-card-meta",children:[l.jsx("span",{className:"media-card-type",children:p6(a)}),a.status==="uploading"?l.jsxs(l.Fragment,{children:[l.jsx(Kt,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":m6(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?l.jsx(gc,{className:"media-card-open"}):null]});return l.jsxs(Wt.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?l.jsx(KL,{src:c,children:d}):d,r?l.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:l.jsx(Zr,{})}):null]},a.id)})}),l.jsx(ni,{children:s?l.jsx(Bpe,{appName:e,item:s,onClose:()=>i(null)}):null})]})}function Bpe({appName:e,item:t,onClose:n}){const r=E.useMemo(()=>g6(t,e),[e,t]),s=y_(t.mimeType),[i,a]=E.useState(""),[o,c]=E.useState(s==="text"||s==="markdown"),[u,d]=E.useState("");return E.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),E.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[s,r]),l.jsx(Wt.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:l.jsxs(Wt.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[l.jsxs("header",{className:"media-viewer-header",children:[l.jsxs("div",{children:[l.jsx("strong",{children:t.name??"附件"}),l.jsxs("span",{children:[p6(t),t.sizeBytes?` · ${m6(t.sizeBytes)}`:""]})]}),l.jsxs("nav",{children:[l.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:l.jsx(Jw,{})}),l.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:l.jsx(Zr,{})})]})]}),l.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?l.jsx("img",{src:r,alt:t.name??"图片"}):null,s==="video"?l.jsx("div",{className:"media-viewer-video-wrapper",children:l.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?l.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?l.jsxs("div",{className:"media-viewer-loading",children:[l.jsx(Kt,{})," 正在读取文档…"]}):null,!o&&u?l.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&s==="markdown"?l.jsx("div",{className:"media-document",children:l.jsx(sh,{text:i})}):null,!o&&s==="text"?l.jsx("pre",{className:"media-document media-document--plain",children:i}):null]})]})})}function Fpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),l.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function Upe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),l.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),l.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),l.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function $pe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),l.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),l.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function Hpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),l.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),l.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function zpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),l.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),l.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),l.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function Vpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),l.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),l.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function Kpe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),l.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),l.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),l.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function y6(e){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:l.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Ype({definition:e,label:t,done:n,open:r,onToggle:s}){const i=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return l.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:s,"aria-expanded":r,children:[l.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:l.jsx(i,{})}),n?l.jsx("span",{className:"builtin-tool-label",children:a}):l.jsx(pa,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),l.jsx(y6,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const Gpe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Fpe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:Kpe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Upe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:$pe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:Hpe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:zpe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:Vpe}};function Wpe(e){return Gpe[e]}const b6="send_a2ui_json_to_client",qpe=28;function Xpe(e,t,n){let r=t;for(let s=0;s65535?2:1}return r}function Qpe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function E6(e,t,n){const[r,s]=E.useState(()=>t?"":e),i=E.useRef(r),a=E.useRef(e),o=E.useRef(null),c=E.useRef(0),u=E.useRef(n);return a.current=e,u.current=n,E.useEffect(()=>{const d=i.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null,d!==e&&(i.current=e,s(e));return}if(d===e||o.current!==null)return;const h=p=>{const m=a.current,g=i.current;if(!m.startsWith(g)){i.current=m,s(m),o.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[r]),E.useEffect(()=>()=>{o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)},[]),r}function Zpe({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Jpe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function eme(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function x6({text:e,done:t,streaming:n=!1,onStreamFrame:r}){const[s,i]=E.useState(!t),a=E.useRef(!1);E.useEffect(()=>{a.current||i(!t)},[t]);const o=()=>{a.current=!0,i(h=>!h)},c=e.replace(/^\s+/,""),u=E6(c,!t||n,r),{ref:d,onScroll:f}=Dpe(u);return l.jsxs("div",{className:"block-thinking",children:[l.jsxs("button",{className:"think-head",onClick:o,type:"button",children:[l.jsx("span",{className:"think-icon","aria-hidden":"true",children:l.jsx(Zpe,{className:`spark ${t?"":"pulse"}`})}),t?l.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):l.jsx(pa,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),l.jsx(Ms,{className:`chev ${s?"open":""}`})]}),l.jsx("div",{className:`think-collapse ${s&&u?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsx("div",{className:"think-body scroll",ref:d,onScroll:f,children:u})})})]})}function w6(){return l.jsx(x6,{text:"",done:!1})}const tme=E.memo(function({text:t,streaming:n,onStreamFrame:r}){const s=E6(t,n,r);return s?l.jsx("div",{className:"bubble",children:l.jsx(sh,{text:s})}):null});function nme({name:e,args:t,response:n,done:r}){const[s,i]=E.useState(!1),a=e===b6?"渲染 UI":e,o=Wpe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` +…(已截断)`:c;return l.jsxs(Wt.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?l.jsx(Ype,{definition:o,label:eme(e,t),done:r,open:s,onToggle:()=>i(d=>!d)}):l.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>i(d=>!d),type:"button","aria-expanded":s,children:[l.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:l.jsx(Jpe,{})}),r?l.jsx("span",{className:"tool-name",children:a}):l.jsx(pa,{className:"tool-name",duration:2.2,spread:15,children:a}),l.jsx(y6,{className:`tool-chevron${s?" is-open":""}`})]}),l.jsx("div",{className:`think-collapse ${s?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsxs("div",{className:"tool-detail",children:[t!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"参数"}),l.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"返回"}),l.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function rme({block:e,onAuth:t}){const[n,r]=E.useState(e.done?"done":"idle"),[s,i]=E.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){i(""),r("authorizing");try{await t(e),r("done")}catch(d){i(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?l.jsxs(Wt.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[l.jsx(BS,{className:"auth-card-icon auth-card-icon--done"}),l.jsxs("span",{children:["已授权 · ",a]})]}):l.jsxs(Wt.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"auth-card-head",children:[l.jsx(BS,{className:"auth-card-icon"}),l.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),l.jsxs("p",{className:"auth-card-desc",children:["工具集 ",l.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&l.jsxs(l.Fragment,{children:[" ","将跳转至 ",l.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),l.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?l.jsxs(l.Fragment,{children:[l.jsx(Kt,{className:"cw-i spin"})," 等待授权…"]}):l.jsx(l.Fragment,{children:"去授权"})}),!e.authUri&&l.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&l.jsx("div",{className:"auth-card-err",children:s})]})}function E_({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onAction:s,onAuth:i}){return l.jsx(l.Fragment,{children:e.map((a,o)=>{switch(a.kind){case"thinking":return l.jsx(x6,{text:a.text,done:a.done,streaming:n,onStreamFrame:r},o);case"text":{const c=a.text.replace(/^\s+/,"");return c?l.jsx(tme,{text:c,streaming:n,onStreamFrame:r},o):null}case"attachment":return l.jsx(b_,{appName:t,items:a.files},o);case"invocation":return l.jsx(g_,{value:a.value},o);case"tool":return a.name===b6&&a.done?null:l.jsx(nme,{name:a.name,args:a.args,response:a.response,done:a.done},o);case"agent-transfer":return null;case"auth":return l.jsx(rme,{block:a,onAuth:i},o);case"a2ui":return h6(a.messages).filter(c=>c.components[c.rootId]).map(c=>l.jsx(Wt.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:l.jsx(jpe,{surface:c,onAction:s})},`${o}-${c.surfaceId}`));default:return null}})})}function v6(e){return e.isComposing||e.keyCode===229}const sme="/assets/arkclaw-DG3MhHYM.png",ime="/assets/codex-Csw-JJxq.png",ame="/assets/hermes-C6L-CfGS.png",qs=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],ome=[{label:"ArkClaw",logo:sme},{label:"Hermes 智能体",logo:ame}];function uC({mode:e}){return e==="skill-create"?l.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),l.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?l.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),l.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):l.jsx(Bc,{className:"new-chat-mode__agent-icon"})}function lme(){return l.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function cme({value:e,onChange:t,disabled:n=!1,temporaryEnabled:r,skillCreateEnabled:s}){const[i,a]=E.useState(!1),[o,c]=E.useState(!1),[u,d]=E.useState(()=>qs.findIndex(k=>k.value===e)),f=E.useRef(null),h=E.useRef(null),p=qs.find(k=>k.value===e)??qs[0],m=p.value==="temporary"?"Codex 智能体":p.label;function g(k){return k.value==="temporary"?r:k.value==="skill-create"?s:!0}function x(k){return g(k)!==!0}function y(k){const N=g(k);return N===void 0?"正在检查配置":N?k.description:"管理员未配置"}E.useEffect(()=>{if(!i)return;const k=N=>{var A;(A=f.current)!=null&&A.contains(N.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]);function w(k){let N=u;do N=(N+k+qs.length)%qs.length;while(x(qs[N]));d(N),c(qs[N].value==="temporary")}function b(k){var N;if(!x(k)){if(k.value==="temporary"){c(!0);return}t(k.value),a(!1),c(!1),(N=h.current)==null||N.focus()}}function _(){t("temporary"),a(!1),c(!1)}return l.jsxs("div",{className:"new-chat-mode",ref:f,children:[l.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":i,disabled:n,onClick:()=>{d(qs.findIndex(k=>k.value===e)),a(k=>(k&&c(!1),!k))},onKeyDown:k=>{k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),i?w(k.key==="ArrowDown"?1:-1):a(!0)):i&&(k.key==="Enter"||k.key===" ")?(k.preventDefault(),b(qs[u])):i&&k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1))},children:[l.jsx("span",{className:"new-chat-mode__icon",children:l.jsx(uC,{mode:p.value})}),l.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),l.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),i?l.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:k=>{var N;k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),w(k.key==="ArrowDown"?1:-1)):k.key==="Enter"?(k.preventDefault(),b(qs[u])):k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1),(N=h.current)==null||N.focus())},children:qs.map((k,N)=>{const A=k.value==="temporary";return l.jsxs("button",{type:"button",role:"option","aria-selected":e===k.value,"aria-haspopup":A?"menu":void 0,"aria-expanded":A?o:void 0,"aria-disabled":x(k),disabled:x(k),className:`new-chat-mode__option${N===u?" is-active":""}`,onMouseEnter:()=>{d(N),c(k.value==="temporary")},onClick:()=>b(k),children:[l.jsx("span",{className:"new-chat-mode__option-icon",children:l.jsx(uC,{mode:k.value})}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsxs("span",{className:"new-chat-mode__label",children:[k.label,k.value==="skill-create"?l.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),l.jsx("span",{children:y(k)})]}),A?l.jsx(lme,{}):e===k.value?l.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},k.value)})}):null,i&&o?l.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:_,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:ime,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),l.jsx("span",{children:"在沙箱中执行任务"})]})]}),ome.map(({label:k,logo:N})=>l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:N,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:k}),l.jsx("span",{children:"暂不可用"})]})]},k))]}):null]})}const x_=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function ume(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"8.2",cy:"8.2",r:"4.7"}),l.jsx("path",{d:"m11.7 11.7 4.1 4.1"}),l.jsx("path",{d:"M14.8 2.7v3.2M13.2 4.3h3.2"}),l.jsx("circle",{cx:"8.2",cy:"8.2",r:"1",fill:"currentColor",stroke:"none"})]})}function dme(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"4.2",cy:"15.4",r:"1.4"}),l.jsx("circle",{cx:"15.7",cy:"4.2",r:"1.4"}),l.jsx("path",{d:"M5.7 15.1c3.5-.3 1.8-4.7 5.1-5.1 2.8-.4 2.1-3.7 3.5-4.8"}),l.jsx("path",{d:"m12.7 14.2 1.5 1.5 2.9-3.3"})]})}function fme(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M3.2 5.2h7.1M3.2 9.5h5.2M3.2 13.8h4"}),l.jsx("path",{d:"m10.1 14.8.6-2.8 4.7-4.7 2.2 2.2-4.7 4.7-2.8.6Z"}),l.jsx("path",{d:"M14.5 3.1v2.5M13.2 4.4h2.6"})]})}const hme=[{icon:ume,text:"帮我分析一个问题,并给出清晰的解决思路"},{icon:dme,text:"根据我的目标,制定一份可执行的行动计划"},{icon:fme,text:"帮我整理并润色一段内容,让表达更清晰"}];function pme({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:s,onChange:i,onSubmit:a,disabled:o,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:g=!0,onInvocationChange:x,onAddFiles:y,onRemoveAttachment:w,newChatMode:b="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:N,temporaryEnabled:A,skillCreateEnabled:S}){const C=E.useRef(null),R=E.useRef(null),O=E.useRef(null),F=E.useRef(null),[q,L]=E.useState(!1),[D,T]=E.useState(null),[M,j]=E.useState(0),[U,I]=E.useState(!1);async function K(){if(e)try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{I(!1)}}E.useLayoutEffect(()=>{const Z=C.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.min(Z.scrollHeight,200)}px`)},[s]);const W=b==="skill-create";E.useEffect(()=>{W&&(L(!1),T(null))},[W]);const B=!W&&d.some(Z=>Z.status!=="ready"),ie=!o&&!c&&!B&&(s.trim().length>0||!W&&d.length>0),Q=(D==null?void 0:D.query.toLocaleLowerCase())??"",ee=(D==null?void 0:D.kind)==="skill"?f.filter(Z=>!p.skills.some(me=>me.name===Z.name)).filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(Q)).map(Z=>({kind:"skill",value:Z})):(D==null?void 0:D.kind)==="agent"?h.filter(Z=>`${Z.name} ${Z.description}`.toLocaleLowerCase().includes(Q)).map(Z=>({kind:"agent",value:Z})):[];function ce(Z){var me;L(!1),T(null),(me=Z.current)==null||me.click()}function J(Z){i(Z),L(!1),T(null),requestAnimationFrame(()=>{var me,Ne;(me=C.current)==null||me.focus(),(Ne=C.current)==null||Ne.setSelectionRange(Z.length,Z.length)})}function fe(Z,me){const Ne=Z.slice(0,me),Ie=/(^|\s)([/@])([^\s/@]*)$/.exec(Ne);if(!Ie){T(null);return}const We=Ie[2].length+Ie[3].length,Ce={kind:Ie[2]==="/"?"skill":"agent",query:Ie[3],start:me-We,end:me},et=!D||D.kind!==Ce.kind||D.query!==Ce.query||D.start!==Ce.start||D.end!==Ce.end;T(Ce),et&&j(0),L(!1)}function te(Z){if(!D)return;const me=s.slice(0,D.start)+s.slice(D.end);i(me),Z.kind==="skill"?x({...p,skills:[...p.skills,Z.value]}):x({skills:[],targetAgent:Z.value});const Ne=D.start;T(null),requestAnimationFrame(()=>{var Ie,We;(Ie=C.current)==null||Ie.focus(),(We=C.current)==null||We.setSelectionRange(Ne,Ne)})}function ge(){if(p.targetAgent){x({skills:[]});return}p.skills.length>0&&x({...p,skills:p.skills.slice(0,-1)})}function we(Z){const me=Z.target.files?Array.from(Z.target.files):[];me.length&&y(me),Z.target.value=""}return l.jsxs("div",{className:`composer${_?" composer--new-chat":""}${W?" composer--skill-mode":""}`,children:[W?null:l.jsx(g_,{value:p,onRemoveSkill:Z=>x({...p,skills:p.skills.filter(me=>me.name!==Z)}),onRemoveAgent:()=>x({skills:[]})}),!W&&d.length>0&&l.jsx(b_,{appName:n,compact:!0,items:d,onRemove:w}),l.jsxs("div",{className:"composer-box",children:[D?l.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":D.kind==="skill"?"可用技能":"可用子 Agent",children:[l.jsxs("div",{className:"composer-command-head",children:[D.kind==="skill"?l.jsx(nl,{}):l.jsx(qL,{}),l.jsx("span",{children:D.kind==="skill"?"调用技能":"使用子 Agent"}),l.jsx("kbd",{children:D.kind==="skill"?"/":"@"})]}),m?l.jsxs("div",{className:"composer-command-empty",children:[l.jsx(Kt,{className:"spin"})," 正在读取 Agent 能力…"]}):ee.length===0?l.jsx("div",{className:"composer-command-empty",children:D.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):l.jsx("div",{className:"composer-command-list",children:ee.map((Z,me)=>l.jsxs("button",{type:"button",role:"option","aria-selected":me===M,className:`composer-command-item${me===M?" is-active":""}`,onMouseDown:Ne=>{Ne.preventDefault(),te(Z)},onMouseEnter:()=>j(me),children:[l.jsx("span",{className:`composer-command-icon composer-command-icon--${Z.kind}`,children:Z.kind==="skill"?l.jsx(nl,{}):l.jsx(tl,{})}),l.jsxs("span",{className:"composer-command-copy",children:[l.jsxs("strong",{children:[Z.kind==="skill"?"/":"@",Z.value.name]}),l.jsx("span",{children:Z.value.description||(Z.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),l.jsx("kbd",{children:me===M?"↵":Z.kind==="skill"?"技能":"Agent"})]},`${Z.kind}-${Z.value.name}`))})]}):null,W?null:l.jsxs("div",{className:"composer-menu-wrap",children:[l.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!g,onClick:()=>{T(null),L(Z=>!Z)},children:l.jsx(ir,{className:"icon"})}),q&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>L(!1)}),l.jsxs("div",{className:"composer-menu",role:"menu",children:[l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(R),children:[l.jsx(nM,{className:"icon"}),"上传图片"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(O),children:[l.jsx(JL,{className:"icon"}),"上传文档或 PDF"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ce(F),children:[l.jsx(eM,{className:"icon"}),"上传视频"]})]})]})]}),k&&N?l.jsx(cme,{value:b,onChange:N,disabled:c,temporaryEnabled:A,skillCreateEnabled:S}):null,l.jsx("div",{className:"composer-input-stack",children:l.jsx("textarea",{ref:C,className:"comp-input scroll",rows:_?4:1,value:s,disabled:o,placeholder:W?`描述你想创建的 Skill,将使用 ${x_.join(" 和 ")} 并行创建…`:o?"请在页面左上角选择智能体":`向 ${r} 发消息…`,"aria-expanded":!!D,onChange:Z=>{i(Z.target.value),W||fe(Z.target.value,Z.target.selectionStart)},onSelect:Z=>{W||fe(Z.currentTarget.value,Z.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>T(null),0),onKeyDown:Z=>{if(!v6(Z.nativeEvent)){if(D){if(Z.key==="ArrowDown"&&ee.length>0){Z.preventDefault(),j(me=>(me+1)%ee.length);return}if(Z.key==="ArrowUp"&&ee.length>0){Z.preventDefault(),j(me=>(me-1+ee.length)%ee.length);return}if((Z.key==="Enter"||Z.key==="Tab")&&ee[M]){Z.preventDefault(),te(ee[M]);return}if(Z.key==="Escape"){Z.preventDefault(),T(null);return}}if(Z.key==="Backspace"&&!s&&Z.currentTarget.selectionStart===0&&Z.currentTarget.selectionEnd===0){ge();return}Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),ie&&a())}}})}),l.jsx(Wt.button,{type:"button",className:"comp-send",disabled:!ie,onClick:a,"aria-label":"发送",whileTap:ie?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?l.jsx(Kt,{className:"icon spin"}):l.jsx(WL,{className:"icon"})})]}),_&&b==="agent"&&!s.trim()?l.jsx("div",{className:"prompt-suggestions","aria-label":"快捷提示",children:hme.map(Z=>{const me=Z.icon;return l.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:o||c,onClick:()=>J(Z.text),children:[l.jsx(me,{}),l.jsx("span",{children:Z.text})]},Z.text)})}):null,u&&l.jsxs("div",{className:"composer-meta",children:[l.jsxs("span",{className:"composer-session-line",children:["会话 ID:",l.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&l.jsx("button",{type:"button",className:"composer-session-copy",title:U?"已复制":"复制会话 ID","aria-label":U?"已复制会话 ID":"复制会话 ID",onClick:()=>void K(),children:U?l.jsx(pi,{}):l.jsx(Zw,{})})]}),l.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),l.jsx("span",{children:"回答仅供参考"})]}),l.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:we}),l.jsx("input",{ref:O,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:we}),l.jsx("input",{ref:F,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:we})]})}function _6({title:e,sub:t,cards:n,footer:r}){return l.jsxs("div",{className:"stk",children:[l.jsxs("div",{className:"stk-head",children:[l.jsx("h1",{className:"stk-title",children:e}),t&&l.jsx("p",{className:"stk-sub",children:t})]}),l.jsx("div",{className:"stk-list",children:n.map((s,i)=>l.jsxs(Wt.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:i*.04},children:[l.jsx("span",{className:"stk-card-icon",children:l.jsx(s.icon,{})}),l.jsxs("span",{className:"stk-card-text",children:[l.jsx("span",{className:"stk-card-title",children:s.title}),l.jsx("span",{className:"stk-card-desc",children:s.desc})]}),l.jsx(Ms,{className:"stk-card-arrow"})]},s.key))}),r&&l.jsx("div",{className:"stk-footer",children:r})]})}const w_=Symbol.for("yaml.alias"),ux=Symbol.for("yaml.document"),to=Symbol.for("yaml.map"),k6=Symbol.for("yaml.pair"),Pi=Symbol.for("yaml.scalar"),bu=Symbol.for("yaml.seq"),$s=Symbol.for("yaml.node.type"),Eu=e=>!!e&&typeof e=="object"&&e[$s]===w_,fh=e=>!!e&&typeof e=="object"&&e[$s]===ux,hh=e=>!!e&&typeof e=="object"&&e[$s]===to,Un=e=>!!e&&typeof e=="object"&&e[$s]===k6,rn=e=>!!e&&typeof e=="object"&&e[$s]===Pi,ph=e=>!!e&&typeof e=="object"&&e[$s]===bu;function Bn(e){if(e&&typeof e=="object")switch(e[$s]){case to:case bu:return!0}return!1}function Fn(e){if(e&&typeof e=="object")switch(e[$s]){case w_:case to:case Pi:case bu:return!0}return!1}const N6=e=>(rn(e)||Bn(e))&&!!e.anchor,Co=Symbol("break visit"),mme=Symbol("skip children"),Vd=Symbol("remove node");function xu(e,t){const n=gme(t);fh(e)?ac(null,e.contents,n,Object.freeze([e]))===Vd&&(e.contents=null):ac(null,e,n,Object.freeze([]))}xu.BREAK=Co;xu.SKIP=mme;xu.REMOVE=Vd;function ac(e,t,n,r){const s=yme(e,t,n,r);if(Fn(s)||Un(s))return bme(e,r,s),ac(e,s,n,r);if(typeof s!="symbol"){if(Bn(t)){r=Object.freeze(r.concat(t));for(let i=0;ie.replace(/[!,[\]{}]/g,t=>Eme[t]);class Lr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Lr.defaultYaml,t),this.tags=Object.assign({},Lr.defaultTags,n)}clone(){const t=new Lr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Lr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Lr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Lr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Lr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Lr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const a=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,a),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+xme(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(t&&r.length>0&&Fn(t.contents)){const i={};xu(t.contents,(a,o)=>{Fn(o)&&o.tag&&(i[o.tag]=!0)}),s=Object.keys(i)}else s=[];for(const[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(o=>o.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join(` +`)}}Lr.defaultYaml={explicit:!1,version:"1.2"};Lr.defaultTags={"!!":"tag:yaml.org,2002:"};function S6(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function T6(e){const t=new Set;return xu(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function A6(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function wme(e,t){const n=[],r=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=T6(e));const a=A6(t,s);return s.add(a),a},setAnchors:()=>{for(const i of n){const a=r.get(i);if(typeof a=="object"&&a.anchor&&(rn(a.node)||Bn(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}function oc(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;sPs(r,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!N6(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=i=>{r.res=i,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class v_{constructor(t){Object.defineProperty(this,$s,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!fh(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=Ps(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof i=="function"?oc(i,{"":o},"",o):o}}class __ extends v_{constructor(t){super(w_),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],xu(t,{Node:(i,a)=>{(Eu(a)||N6(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let s;for(const i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:i}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(Ps(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=am(s,a,r)),o.count*o.aliasCount>i)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){const s=`*${this.source}`;if(t){if(S6(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${s} `}return s}}function am(e,t,n){if(Eu(t)){const r=t.resolve(e),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(Bn(t)){let r=0;for(const s of t.items){const i=am(e,s,n);i>r&&(r=i)}return r}else if(Un(t)){const r=am(e,t.key,n),s=am(e,t.value,n);return Math.max(r,s)}return 1}const C6=e=>!e||typeof e!="function"&&typeof e!="object";class ht extends v_{constructor(t){super(Pi),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ps(this.value,t,n)}toString(){return String(this.value)}}ht.BLOCK_FOLDED="BLOCK_FOLDED";ht.BLOCK_LITERAL="BLOCK_LITERAL";ht.PLAIN="PLAIN";ht.QUOTE_DOUBLE="QUOTE_DOUBLE";ht.QUOTE_SINGLE="QUOTE_SINGLE";const vme="tag:yaml.org,2002:";function _me(e,t,n){if(t){const r=n.filter(i=>i.tag===t),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,e))&&!r.format})}function Df(e,t,n){var f,h,p;if(fh(e)&&(e=e.contents),Fn(e))return e;if(Un(e)){const m=(h=(f=n.schema[to]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:a,sourceObjects:o}=n;let c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=s(e)),new __(c.anchor);c={anchor:null,node:null},o.set(e,c)}t!=null&&t.startsWith("!!")&&(t=vme+t.slice(2));let u=_me(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new ht(e);return c&&(c.node=m),m}u=e instanceof Map?a[to]:Symbol.iterator in Object(e)?a[bu]:a[to]}i&&(i(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new ht(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function bg(e,t,n){let r=n;for(let s=t.length-1;s>=0;--s){const i=t[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return Df(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const md=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class I6 extends v_{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Fn(r)||Un(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(md(t))this.add(n);else{const[r,...s]=t,i=this.get(r,!0);if(Bn(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,bg(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(Bn(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...s]=t,i=this.get(r,!0);return s.length===0?!n&&rn(i)?i.value:i:Bn(i)?i.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Un(n))return!1;const r=n.value;return r==null||t&&rn(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const s=this.get(n,!0);return Bn(s)?s.hasIn(r):!1}setIn(t,n){const[r,...s]=t;if(s.length===0)this.set(r,n);else{const i=this.get(r,!0);if(Bn(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,bg(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const kme=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function sa(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Uo=(e,t,n)=>e.endsWith(` `)?sa(n,t):n.includes(` `)?` `+sa(n,t):(e.endsWith(" ")?"":" ")+n,R6="flow",dx="block",om="quoted";function O0(e,t,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!s||s<0)return e;ss-Math.max(2,i)?u.push(0):f=s-r);let h,p,m=!1,g=-1,x=-1,y=-1;n===dx&&(g=dC(e,g,t.length),g!==-1&&(f=g+c));for(let b;b=e[g+=1];){if(n===om&&b==="\\"){switch(x=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(b===` @@ -586,16 +586,16 @@ https://github.com/highlightjs/highlight.js/issues/2277`),I=T,U=M),j===void 0&&( `&&_!==" "&&(h=g)}if(g>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===om){for(;p===" "||p===" ";)p=b,b=e[g+=1],m=!0;const _=g>y+1?g-2:x-1;if(d[_])return e;u.push(_),d[_]=!0,f=_+c,h=void 0}else m=!0}p=b}if(m&&o&&o(),u.length===0)return e;a&&a();let w=e.slice(0,u[0]);for(let b=0;b({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),M0=e=>/^(%|---|\.\.\.)/m.test(e);function kme(e,t,n){if(!t||t<0)return!1;const r=t-n,s=e.length;if(s<=r)return!1;for(let i=0,a=0;ir)return!0;if(a=i+1,s-a<=r)return!1}return!0}function Vd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(M0(e)?" ":"");let a="",o=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);const d=n.substr(c+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),M0=e=>/^(%|---|\.\.\.)/m.test(e);function Nme(e,t,n){if(!t||t<0)return!1;const r=t-n,s=e.length;if(s<=r)return!1;for(let i=0,a=0;ir)return!0;if(a=i+1,s-a<=r)return!1}return!0}function Kd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(M0(e)?" ":"");let a="",o=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);const d=n.substr(c+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const k=n[h-1];if(k!==` `&&k!==" "&&k!==" ")break}let p=n.substring(h);const m=p.indexOf(` @@ -604,13 +604,13 @@ ${n}`)+"'";return t.implicitKey?r:O0(r,n,R6,L0(t,!1))}function lc(e,t){const{sin `)y=x;else break}let w=n.substring(0,y{N=!0});const S=O0(`${w}${k}${p}`,u,dx,A);if(!N)return`>${_} ${u}${S}`}return n=n.replace(/\n+/g,`$&${u}`),`|${_} -${u}${w}${n}${p}`}function Nme(e,t,n,r){const{type:s,value:i}=e,{actualString:a,implicitKey:o,indent:c,indentStep:u,inFlow:d}=t;if(o&&i.includes(` +${u}${w}${n}${p}`}function Sme(e,t,n,r){const{type:s,value:i}=e,{actualString:a,implicitKey:o,indent:c,indentStep:u,inFlow:d}=t;if(o&&i.includes(` `)||d&&/[[\]{},]/.test(i))return lc(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||d||!i.includes(` `)?lc(i,t):lm(e,t,n,r);if(!o&&!d&&s!==ht.PLAIN&&i.includes(` `))return lm(e,t,n,r);if(M0(i)){if(c==="")return t.forceBlockIndent=!0,lm(e,t,n,r);if(o&&c===u)return lc(i,t)}const f=i.replace(/\n+/g,`$& -${c}`);if(a){const h=g=>{var x;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((x=g.test)==null?void 0:x.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return lc(i,t)}return o?f:O0(f,c,R6,L0(t,!1))}function k_(e,t,n,r){const{implicitKey:s,inFlow:i}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==ht.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=ht.QUOTE_DOUBLE);const c=d=>{switch(d){case ht.BLOCK_FOLDED:case ht.BLOCK_LITERAL:return s||i?lc(a.value,t):lm(a,t,n,r);case ht.QUOTE_DOUBLE:return Vd(a.value,t);case ht.QUOTE_SINGLE:return fx(a.value,t);case ht.PLAIN:return Nme(a,t,n,r);default:return null}};let u=c(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function O6(e,t){const n=Object.assign({blockQuote:!0,commentString:_me,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Sme(e,t){var s;if(t.tag){const i=e.filter(a=>a.tag===t.tag);if(i.length>0)return i.find(a=>a.format===t.format)??i[0]}let n,r;if(rn(t)){r=t.value;let i=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){const a=i.filter(o=>o.test);a.length>0&&(i=a)}n=i.find(a=>a.format===t.format)??i.find(a=>!a.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Tme(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],i=(rn(e)||Bn(e))&&e.anchor;i&&S6(i)&&(n.add(i),s.push(`&${i}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(r.directives.tagString(a)),s.join(" ")}function tu(e,t,n,r){var c;if(Un(e))return e.toString(t,n,r);if(bu(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const i=Fn(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=Sme(t.doc.schema.tags,i));const a=Tme(i,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof s.stringify=="function"?s.stringify(i,t,n,r):rn(i)?k_(i,t,n,r):i.toString(t,n,r);return a?rn(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} -${t.indent}${o}`:o}function Ame({key:e,value:t},n,r,s){const{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Fn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Bn(e)||!Fn(e)&&typeof e=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Bn(e)||(rn(e)?e.type===ht.BLOCK_FOLDED||e.type===ht.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+c});let m=!1,g=!1,x=tu(e,n,()=>m=!0,()=>g=!0);if(!p&&!n.inFlow&&x.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return m&&r&&r(),x===""?"?":p?`? ${x}`:x}else if(i&&!f||t==null&&p)return x=`? ${x}`,h&&!m?x+=Uo(x,n.indent,u(h)):g&&s&&s(),x;m&&(h=null),p?(h&&(x+=Uo(x,n.indent,u(h))),x=`? ${x} -${o}:`):(x=`${x}:`,h&&(x+=Uo(x,n.indent,u(h))));let y,w,b;Fn(t)?(y=!!t.spaceBefore,w=t.commentBefore,b=t.comment):(y=!1,w=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&rn(t)&&(n.indentAtStart=x.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&ph(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=tu(t,n,()=>_=!0,()=>g=!0);let N=" ";if(h||y||w){if(N=y?` +${c}`);if(a){const h=g=>{var x;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((x=g.test)==null?void 0:x.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return lc(i,t)}return o?f:O0(f,c,R6,L0(t,!1))}function k_(e,t,n,r){const{implicitKey:s,inFlow:i}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==ht.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=ht.QUOTE_DOUBLE);const c=d=>{switch(d){case ht.BLOCK_FOLDED:case ht.BLOCK_LITERAL:return s||i?lc(a.value,t):lm(a,t,n,r);case ht.QUOTE_DOUBLE:return Kd(a.value,t);case ht.QUOTE_SINGLE:return fx(a.value,t);case ht.PLAIN:return Sme(a,t,n,r);default:return null}};let u=c(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function O6(e,t){const n=Object.assign({blockQuote:!0,commentString:kme,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Tme(e,t){var s;if(t.tag){const i=e.filter(a=>a.tag===t.tag);if(i.length>0)return i.find(a=>a.format===t.format)??i[0]}let n,r;if(rn(t)){r=t.value;let i=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){const a=i.filter(o=>o.test);a.length>0&&(i=a)}n=i.find(a=>a.format===t.format)??i.find(a=>!a.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Ame(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],i=(rn(e)||Bn(e))&&e.anchor;i&&S6(i)&&(n.add(i),s.push(`&${i}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(r.directives.tagString(a)),s.join(" ")}function nu(e,t,n,r){var c;if(Un(e))return e.toString(t,n,r);if(Eu(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const i=Fn(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=Tme(t.doc.schema.tags,i));const a=Ame(i,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof s.stringify=="function"?s.stringify(i,t,n,r):rn(i)?k_(i,t,n,r):i.toString(t,n,r);return a?rn(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} +${t.indent}${o}`:o}function Cme({key:e,value:t},n,r,s){const{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=Fn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Bn(e)||!Fn(e)&&typeof e=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||Bn(e)||(rn(e)?e.type===ht.BLOCK_FOLDED||e.type===ht.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+c});let m=!1,g=!1,x=nu(e,n,()=>m=!0,()=>g=!0);if(!p&&!n.inFlow&&x.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return m&&r&&r(),x===""?"?":p?`? ${x}`:x}else if(i&&!f||t==null&&p)return x=`? ${x}`,h&&!m?x+=Uo(x,n.indent,u(h)):g&&s&&s(),x;m&&(h=null),p?(h&&(x+=Uo(x,n.indent,u(h))),x=`? ${x} +${o}:`):(x=`${x}:`,h&&(x+=Uo(x,n.indent,u(h))));let y,w,b;Fn(t)?(y=!!t.spaceBefore,w=t.commentBefore,b=t.comment):(y=!1,w=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&rn(t)&&(n.indentAtStart=x.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&ph(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=nu(t,n,()=>_=!0,()=>g=!0);let N=" ";if(h||y||w){if(N=y?` `:"",w){const A=u(w);N+=` ${sa(A,n.indent)}`}k===""&&!n.inFlow?N===` `&&b&&(N=` @@ -619,32 +619,32 @@ ${sa(A,n.indent)}`}k===""&&!n.inFlow?N===` ${n.indent}`}else if(!p&&Bn(t)){const A=k[0],S=k.indexOf(` `),C=S!==-1,R=n.inFlow??t.flow??t.items.length===0;if(C||!R){let O=!1;if(C&&(A==="&"||A==="!")){let F=k.indexOf(" ");A==="&"&&F!==-1&&Fe===vp||typeof e=="symbol"&&e.description===vp,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ht(Symbol(vp)),{addToJSMap:M6}),stringify:()=>vp},Cme=(e,t)=>(la.identify(t)||rn(t)&&(!t.type||t.type===ht.PLAIN)&&la.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===la.tag&&n.default));function M6(e,t,n){const r=j6(e,n);if(ph(r))for(const s of r.items)Sb(e,t,s);else if(Array.isArray(r))for(const s of r)Sb(e,t,s);else Sb(e,t,r)}function Sb(e,t,n){const r=j6(e,n);if(!hh(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,e,Map);for(const[i,a]of s)t instanceof Map?t.has(i)||t.set(i,a):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function j6(e,t){return e&&bu(t)?t.resolve(e.doc,e):t}function D6(e,t,{key:n,value:r}){if(Fn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Cme(e,n))M6(e,t,r);else{const s=Ps(n,"",e);if(t instanceof Map)t.set(s,Ps(r,s,e));else if(t instanceof Set)t.add(s);else{const i=Ime(n,s,e),a=Ps(r,i,e);i in t?Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[i]=a}}return t}function Ime(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Fn(e)&&(n!=null&&n.doc)){const r=O6(n.doc,{});r.anchors=new Set;for(const i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=e.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),L6(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(t)}function N_(e,t,n){const r=Df(e,void 0,n),s=Df(t,void 0,n);return new Pr(r,s)}class Pr{constructor(t,n=null){Object.defineProperty(this,$s,{value:k6}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return Fn(n)&&(n=n.clone(t)),Fn(r)&&(r=r.clone(t)),new Pr(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return D6(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Ame(this,t,n,r):JSON.stringify(this)}}function P6(e,t,n){return(t.inFlow??e.flow?Ome:Rme)(e,t,n)}function Rme({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:a,onComment:o}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null});let f=!1;const h=[];for(let m=0;mx=null,()=>f=!0);x&&(y+=Uo(y,i,u(x))),f&&x&&(f=!1),h.push(r+y)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;me===vp||typeof e=="symbol"&&e.description===vp,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ht(Symbol(vp)),{addToJSMap:M6}),stringify:()=>vp},Ime=(e,t)=>(la.identify(t)||rn(t)&&(!t.type||t.type===ht.PLAIN)&&la.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===la.tag&&n.default));function M6(e,t,n){const r=j6(e,n);if(ph(r))for(const s of r.items)Sb(e,t,s);else if(Array.isArray(r))for(const s of r)Sb(e,t,s);else Sb(e,t,r)}function Sb(e,t,n){const r=j6(e,n);if(!hh(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,e,Map);for(const[i,a]of s)t instanceof Map?t.has(i)||t.set(i,a):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function j6(e,t){return e&&Eu(t)?t.resolve(e.doc,e):t}function D6(e,t,{key:n,value:r}){if(Fn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Ime(e,n))M6(e,t,r);else{const s=Ps(n,"",e);if(t instanceof Map)t.set(s,Ps(r,s,e));else if(t instanceof Set)t.add(s);else{const i=Rme(n,s,e),a=Ps(r,i,e);i in t?Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[i]=a}}return t}function Rme(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Fn(e)&&(n!=null&&n.doc)){const r=O6(n.doc,{});r.anchors=new Set;for(const i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=e.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),L6(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(t)}function N_(e,t,n){const r=Df(e,void 0,n),s=Df(t,void 0,n);return new Pr(r,s)}class Pr{constructor(t,n=null){Object.defineProperty(this,$s,{value:k6}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return Fn(n)&&(n=n.clone(t)),Fn(r)&&(r=r.clone(t)),new Pr(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return D6(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Cme(this,t,n,r):JSON.stringify(this)}}function P6(e,t,n){return(t.inFlow??e.flow?Lme:Ome)(e,t,n)}function Ome({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:a,onComment:o}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null});let f=!1;const h=[];for(let m=0;mx=null,()=>f=!0);x&&(y+=Uo(y,i,u(x))),f&&x&&(f=!1),h.push(r+y)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;mx=null);u||(u=f.length>d||y.includes(` +`+sa(u(e),c),o&&o()):f&&a&&a(),p}function Lme({items:e},t,{flowChars:n,itemIndent:r}){const{indent:s,indentStep:i,flowCollectionPadding:a,options:{commentString:o}}=t;r+=i;const c=Object.assign({},t,{indent:r,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let m=0;mx=null);u||(u=f.length>d||y.includes(` `)),m0&&(u||(u=f.reduce((w,b)=>w+b.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),x&&(y+=Uo(y,r,o(x))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((g,x)=>g+x.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const g of f)m+=g?` ${i}${s}${g}`:` `;return`${m} -${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function Eg({indent:e,options:{commentString:t}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){const i=sa(t(r),e);n.push(i.trimStart())}}function $o(e,t){const n=rn(t)?t.value:t;for(const r of e)if(Un(r)&&(r.key===t||r.key===n||rn(r.key)&&r.key.value===n))return r}class Os extends I6{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(to,t),this.items=[]}static from(t,n,r){const{keepUndefined:s,replacer:i}=r,a=new this(t),o=(c,u)=>{if(typeof i=="function")u=i.call(n,c,u);else if(Array.isArray(i)&&!i.includes(c))return;(u!==void 0||s)&&a.items.push(N_(c,u,r))};if(n instanceof Map)for(const[c,u]of n)o(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Un(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Pr(t,t==null?void 0:t.value):r=new Pr(t.key,t.value);const s=$o(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);rn(s.value)&&C6(r.value)?s.value.value=r.value:s.value=r.value}else if(i){const o=this.items.findIndex(c=>i(r,c)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=$o(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=$o(this.items,t),s=r==null?void 0:r.value;return(!n&&rn(s)?s.value:s)??void 0}has(t){return!!$o(this.items,t)}set(t,n){this.add(new Pr(t,n),!0)}toJSON(t,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items)D6(n,s,i);return s}toString(t,n,r){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Un(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),P6(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const xu={collection:"map",default:!0,nodeClass:Os,tag:"tag:yaml.org,2002:map",resolve(e,t){return hh(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Os.from(e,t,n)};class ul extends I6{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(yu,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=_p(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=_p(t);if(typeof r!="number")return;const s=this.items[r];return!n&&rn(s)?s.value:s}has(t){const n=_p(t);return typeof n=="number"&&n=0?t:null}const wu={collection:"seq",default:!0,nodeClass:ul,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ph(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>ul.from(e,t,n)},j0={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),k_(e,t,n,r)}},D0={identify:e=>e==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ht(null),stringify:({source:e},t)=>typeof e=="string"&&D0.test.test(e)?e:t.options.nullStr},S_={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ht(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&S_.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function yi({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=t-(i.length-a-1);for(;o-- >0;)i+="0"}return i}const B6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yi},F6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():yi(e)}},U6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ht(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:yi},P0=e=>typeof e=="bigint"||Number.isInteger(e),T_=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function $6(e,t,n){const{value:r}=e;return P0(r)&&r>=0?n+r.toString(t):yi(e)}const H6={identify:e=>P0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>T_(e,2,8,n),stringify:e=>$6(e,8,"0o")},z6={identify:P0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>T_(e,0,10,n),stringify:yi},V6={identify:e=>P0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>T_(e,2,16,n),stringify:e=>$6(e,16,"0x")},Lme=[xu,wu,j0,D0,S_,H6,z6,V6,B6,F6,U6];function fC(e){return typeof e=="bigint"||Number.isInteger(e)}const kp=({value:e})=>JSON.stringify(e),Mme=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:kp},{identify:e=>e==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:kp},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:kp},{identify:fC,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>fC(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:kp}],jme={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Dme=[xu,wu].concat(Mme,jme),A_={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s{if(typeof i=="function")u=i.call(n,c,u);else if(Array.isArray(i)&&!i.includes(c))return;(u!==void 0||s)&&a.items.push(N_(c,u,r))};if(n instanceof Map)for(const[c,u]of n)o(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Un(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Pr(t,t==null?void 0:t.value):r=new Pr(t.key,t.value);const s=$o(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);rn(s.value)&&C6(r.value)?s.value.value=r.value:s.value=r.value}else if(i){const o=this.items.findIndex(c=>i(r,c)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=$o(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=$o(this.items,t),s=r==null?void 0:r.value;return(!n&&rn(s)?s.value:s)??void 0}has(t){return!!$o(this.items,t)}set(t,n){this.add(new Pr(t,n),!0)}toJSON(t,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items)D6(n,s,i);return s}toString(t,n,r){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Un(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),P6(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const wu={collection:"map",default:!0,nodeClass:Os,tag:"tag:yaml.org,2002:map",resolve(e,t){return hh(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Os.from(e,t,n)};class ul extends I6{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(bu,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=_p(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=_p(t);if(typeof r!="number")return;const s=this.items[r];return!n&&rn(s)?s.value:s}has(t){const n=_p(t);return typeof n=="number"&&n=0?t:null}const vu={collection:"seq",default:!0,nodeClass:ul,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ph(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>ul.from(e,t,n)},j0={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),k_(e,t,n,r)}},D0={identify:e=>e==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ht(null),stringify:({source:e},t)=>typeof e=="string"&&D0.test.test(e)?e:t.options.nullStr},S_={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ht(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&S_.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function yi({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=t-(i.length-a-1);for(;o-- >0;)i+="0"}return i}const B6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yi},F6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():yi(e)}},U6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ht(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:yi},P0=e=>typeof e=="bigint"||Number.isInteger(e),T_=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function $6(e,t,n){const{value:r}=e;return P0(r)&&r>=0?n+r.toString(t):yi(e)}const H6={identify:e=>P0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>T_(e,2,8,n),stringify:e=>$6(e,8,"0o")},z6={identify:P0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>T_(e,0,10,n),stringify:yi},V6={identify:e=>P0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>T_(e,2,16,n),stringify:e=>$6(e,16,"0x")},Mme=[wu,vu,j0,D0,S_,H6,z6,V6,B6,F6,U6];function fC(e){return typeof e=="bigint"||Number.isInteger(e)}const kp=({value:e})=>JSON.stringify(e),jme=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:kp},{identify:e=>e==null,createNode:()=>new ht(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:kp},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:kp},{identify:fC,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>fC(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:kp}],Dme={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Pme=[wu,vu].concat(jme,Dme),A_={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=r.items[0]||new Pr(new ht(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore} ${s.key.commentBefore}`:r.commentBefore),r.comment){const i=s.value??s.key;i.comment=i.comment?`${r.comment} -${i.comment}`:r.comment}r=s}e.items[n]=Un(r)?r:new Pr(r)}}else t("Expected a sequence for this tag");return e}function Y6(e,t,n){const{replacer:r}=n,s=new ul(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;s.items.push(N_(o,c,n))}return s}const C_={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:K6,createNode:Y6};class wc extends ul{constructor(){super(),this.add=Os.prototype.add.bind(this),this.delete=Os.prototype.delete.bind(this),this.get=Os.prototype.get.bind(this),this.has=Os.prototype.has.bind(this),this.set=Os.prototype.set.bind(this),this.tag=wc.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let i,a;if(Un(s)?(i=Ps(s.key,"",n),a=Ps(s.value,i,n)):i=Ps(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(t,n,r){const s=Y6(t,n,r),i=new this;return i.items=s.items,i}}wc.tag="tag:yaml.org,2002:omap";const I_={collection:"seq",identify:e=>e instanceof Map,nodeClass:wc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=K6(e,t),r=[];for(const{key:s}of n.items)rn(s)&&(r.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new wc,n)},createNode:(e,t,n)=>wc.from(e,t,n)};function G6({value:e,source:t},n){return t&&(e?W6:q6).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const W6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ht(!0),stringify:G6},q6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ht(!1),stringify:G6},Pme={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yi},Bme={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():yi(e)}},Fme={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ht(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:yi},mh=e=>typeof e=="bigint"||Number.isInteger(e);function B0(e,t,n,{intAsBigInt:r}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return s==="-"?BigInt(-1)*a:a}const i=parseInt(e,n);return s==="-"?-1*i:i}function R_(e,t,n){const{value:r}=e;if(mh(r)){const s=r.toString(t);return r<0?"-"+n+s.substr(1):n+s}return yi(e)}const Ume={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>B0(e,2,2,n),stringify:e=>R_(e,2,"0b")},$me={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>B0(e,1,8,n),stringify:e=>R_(e,8,"0")},Hme={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>B0(e,0,10,n),stringify:yi},zme={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>B0(e,2,16,n),stringify:e=>R_(e,16,"0x")};class vc extends Os{constructor(t){super(t),this.tag=vc.tag}add(t){let n;Un(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Pr(t.key,null):n=new Pr(t,null),$o(this.items,n.key)||this.items.push(n)}get(t,n){const r=$o(this.items,t);return!n&&Un(r)?rn(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=$o(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Pr(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:s}=r,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),i.items.push(N_(a,null,r));return i}}vc.tag="tag:yaml.org,2002:set";const O_={collection:"map",identify:e=>e instanceof Set,nodeClass:vc,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>vc.from(e,t,n),resolve(e,t){if(hh(e)){if(e.hasAllNullValues(!0))return Object.assign(new vc,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function L_(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*s(60)+s(o),s(0));return n==="-"?s(-1)*i:i}function X6(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return yi(e);let r="";t<0&&(r="-",t*=n(-1));const s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const Q6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>L_(e,n),stringify:X6},Z6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>L_(e,!1),stringify:X6},F0={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(F0.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,i,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,s,i||0,a||0,o||0,c);const d=t[8];if(d&&d!=="Z"){let f=L_(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},hC=[xu,wu,j0,D0,W6,q6,Ume,$me,Hme,zme,Pme,Bme,Fme,A_,la,I_,C_,O_,Q6,Z6,F0],pC=new Map([["core",Lme],["failsafe",[xu,wu,j0]],["json",Dme],["yaml11",hC],["yaml-1.1",hC]]),mC={binary:A_,bool:S_,float:U6,floatExp:F6,floatNaN:B6,floatTime:Z6,int:z6,intHex:V6,intOct:H6,intTime:Q6,map:xu,merge:la,null:D0,omap:I_,pairs:C_,seq:wu,set:O_,timestamp:F0},Vme={"tag:yaml.org,2002:binary":A_,"tag:yaml.org,2002:merge":la,"tag:yaml.org,2002:omap":I_,"tag:yaml.org,2002:pairs":C_,"tag:yaml.org,2002:set":O_,"tag:yaml.org,2002:timestamp":F0};function Tb(e,t,n){const r=pC.get(t);if(r&&!e)return n&&!r.includes(la)?r.concat(la):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{const i=Array.from(pC.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)s=s.concat(i);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(la)),s.reduce((i,a)=>{const o=typeof a=="string"?mC[a]:a;if(!o){const c=JSON.stringify(a),u=Object.keys(mC).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return i.includes(o)||i.push(o),i},[])}const Kme=(e,t)=>e.keyt.key?1:0;class M_{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Tb(t,"compat"):t?Tb(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?Vme:{},this.tags=Tb(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,to,{value:xu}),Object.defineProperty(this,Pi,{value:j0}),Object.defineProperty(this,yu,{value:wu}),this.sortMapEntries=typeof a=="function"?a:a===!0?Kme:null}clone(){const t=Object.create(M_.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Yme(e,t){var c;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const s=O6(e,t),{commentString:i}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=i(e.commentBefore);n.unshift(sa(u,""))}let a=!1,o=null;if(e.contents){if(Fn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=i(e.contents.commentBefore);n.push(sa(f,""))}s.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=tu(e.contents,s,()=>o=null,u);o&&(d+=Uo(d,"",i(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(tu(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=i(e.comment);u.includes(` +${i.comment}`:r.comment}r=s}e.items[n]=Un(r)?r:new Pr(r)}}else t("Expected a sequence for this tag");return e}function Y6(e,t,n){const{replacer:r}=n,s=new ul(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;s.items.push(N_(o,c,n))}return s}const C_={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:K6,createNode:Y6};class vc extends ul{constructor(){super(),this.add=Os.prototype.add.bind(this),this.delete=Os.prototype.delete.bind(this),this.get=Os.prototype.get.bind(this),this.has=Os.prototype.has.bind(this),this.set=Os.prototype.set.bind(this),this.tag=vc.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let i,a;if(Un(s)?(i=Ps(s.key,"",n),a=Ps(s.value,i,n)):i=Ps(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(t,n,r){const s=Y6(t,n,r),i=new this;return i.items=s.items,i}}vc.tag="tag:yaml.org,2002:omap";const I_={collection:"seq",identify:e=>e instanceof Map,nodeClass:vc,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=K6(e,t),r=[];for(const{key:s}of n.items)rn(s)&&(r.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new vc,n)},createNode:(e,t,n)=>vc.from(e,t,n)};function G6({value:e,source:t},n){return t&&(e?W6:q6).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const W6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ht(!0),stringify:G6},q6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ht(!1),stringify:G6},Bme={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:yi},Fme={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():yi(e)}},Ume={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ht(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:yi},mh=e=>typeof e=="bigint"||Number.isInteger(e);function B0(e,t,n,{intAsBigInt:r}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return s==="-"?BigInt(-1)*a:a}const i=parseInt(e,n);return s==="-"?-1*i:i}function R_(e,t,n){const{value:r}=e;if(mh(r)){const s=r.toString(t);return r<0?"-"+n+s.substr(1):n+s}return yi(e)}const $me={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>B0(e,2,2,n),stringify:e=>R_(e,2,"0b")},Hme={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>B0(e,1,8,n),stringify:e=>R_(e,8,"0")},zme={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>B0(e,0,10,n),stringify:yi},Vme={identify:mh,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>B0(e,2,16,n),stringify:e=>R_(e,16,"0x")};class _c extends Os{constructor(t){super(t),this.tag=_c.tag}add(t){let n;Un(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Pr(t.key,null):n=new Pr(t,null),$o(this.items,n.key)||this.items.push(n)}get(t,n){const r=$o(this.items,t);return!n&&Un(r)?rn(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=$o(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Pr(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:s}=r,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),i.items.push(N_(a,null,r));return i}}_c.tag="tag:yaml.org,2002:set";const O_={collection:"map",identify:e=>e instanceof Set,nodeClass:_c,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>_c.from(e,t,n),resolve(e,t){if(hh(e)){if(e.hasAllNullValues(!0))return Object.assign(new _c,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function L_(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*s(60)+s(o),s(0));return n==="-"?s(-1)*i:i}function X6(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return yi(e);let r="";t<0&&(r="-",t*=n(-1));const s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const Q6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>L_(e,n),stringify:X6},Z6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>L_(e,!1),stringify:X6},F0={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(F0.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,i,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,s,i||0,a||0,o||0,c);const d=t[8];if(d&&d!=="Z"){let f=L_(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},hC=[wu,vu,j0,D0,W6,q6,$me,Hme,zme,Vme,Bme,Fme,Ume,A_,la,I_,C_,O_,Q6,Z6,F0],pC=new Map([["core",Mme],["failsafe",[wu,vu,j0]],["json",Pme],["yaml11",hC],["yaml-1.1",hC]]),mC={binary:A_,bool:S_,float:U6,floatExp:F6,floatNaN:B6,floatTime:Z6,int:z6,intHex:V6,intOct:H6,intTime:Q6,map:wu,merge:la,null:D0,omap:I_,pairs:C_,seq:vu,set:O_,timestamp:F0},Kme={"tag:yaml.org,2002:binary":A_,"tag:yaml.org,2002:merge":la,"tag:yaml.org,2002:omap":I_,"tag:yaml.org,2002:pairs":C_,"tag:yaml.org,2002:set":O_,"tag:yaml.org,2002:timestamp":F0};function Tb(e,t,n){const r=pC.get(t);if(r&&!e)return n&&!r.includes(la)?r.concat(la):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{const i=Array.from(pC.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)s=s.concat(i);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(la)),s.reduce((i,a)=>{const o=typeof a=="string"?mC[a]:a;if(!o){const c=JSON.stringify(a),u=Object.keys(mC).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return i.includes(o)||i.push(o),i},[])}const Yme=(e,t)=>e.keyt.key?1:0;class M_{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Tb(t,"compat"):t?Tb(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?Kme:{},this.tags=Tb(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,to,{value:wu}),Object.defineProperty(this,Pi,{value:j0}),Object.defineProperty(this,bu,{value:vu}),this.sortMapEntries=typeof a=="function"?a:a===!0?Yme:null}clone(){const t=Object.create(M_.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Gme(e,t){var c;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const s=O6(e,t),{commentString:i}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=i(e.commentBefore);n.unshift(sa(u,""))}let a=!1,o=null;if(e.contents){if(Fn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=i(e.contents.commentBefore);n.push(sa(f,""))}s.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=nu(e.contents,s,()=>o=null,u);o&&(d+=Uo(d,"",i(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(nu(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=i(e.comment);u.includes(` `)?(n.push("..."),n.push(sa(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(sa(i(u),"")))}return n.join(` `)+` -`}class gh{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$s,{value:ux});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Lr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,s,r)}clone(){const t=Object.create(gh.prototype,{[$s]:{value:ux}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Fn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Rl(this.contents)&&this.contents.add(t)}addIn(t,n){Rl(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=T6(this);t.anchor=!n||r.has(n)?A6(n||"a",r):n}return new __(t.anchor)}createNode(t,n,r){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=n;else if(Array.isArray(n)){const x=w=>typeof w=="number"||w instanceof String||w instanceof Number,y=n.filter(x).map(String);y.length>0&&(n=n.concat(y)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=xme(this,a||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},g=Df(t,d,m);return o&&Bn(g)&&(g.flow=!0),h(),g}createPair(t,n,r={}){const s=this.createNode(t,null,r),i=this.createNode(n,null,r);return new Pr(s,i)}delete(t){return Rl(this.contents)?this.contents.delete(t):!1}deleteIn(t){return pd(t)?this.contents==null?!1:(this.contents=null,!0):Rl(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Bn(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return pd(t)?!n&&rn(this.contents)?this.contents.value:this.contents:Bn(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Bn(this.contents)?this.contents.has(t):!1}hasIn(t){return pd(t)?this.contents!==void 0:Bn(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=bg(this.schema,[t],n):Rl(this.contents)&&this.contents.set(t,n)}setIn(t,n){pd(t)?this.contents=n:this.contents==null?this.contents=bg(this.schema,Array.from(t),n):Rl(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Lr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Lr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new M_(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=Ps(this.contents,n??"",o);if(typeof i=="function")for(const{count:u,res:d}of o.anchors.values())i(d,u);return typeof a=="function"?oc(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Yme(this,t)}}function Rl(e){if(Bn(e))return!0;throw new Error("Expected a YAML collection as document contents")}class J6 extends Error{constructor(t,n,r,s){super(),this.name=t,this.code=r,this.message=s,this.pos=n}}class md extends J6{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class Gme extends J6{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const gC=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){const o=Math.min(i-39,a.length-79);a="…"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,i))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… +`}class gh{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$s,{value:ux});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Lr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,s,r)}clone(){const t=Object.create(gh.prototype,{[$s]:{value:ux}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Fn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Rl(this.contents)&&this.contents.add(t)}addIn(t,n){Rl(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=T6(this);t.anchor=!n||r.has(n)?A6(n||"a",r):n}return new __(t.anchor)}createNode(t,n,r){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=n;else if(Array.isArray(n)){const x=w=>typeof w=="number"||w instanceof String||w instanceof Number,y=n.filter(x).map(String);y.length>0&&(n=n.concat(y)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=wme(this,a||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},g=Df(t,d,m);return o&&Bn(g)&&(g.flow=!0),h(),g}createPair(t,n,r={}){const s=this.createNode(t,null,r),i=this.createNode(n,null,r);return new Pr(s,i)}delete(t){return Rl(this.contents)?this.contents.delete(t):!1}deleteIn(t){return md(t)?this.contents==null?!1:(this.contents=null,!0):Rl(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Bn(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return md(t)?!n&&rn(this.contents)?this.contents.value:this.contents:Bn(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Bn(this.contents)?this.contents.has(t):!1}hasIn(t){return md(t)?this.contents!==void 0:Bn(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=bg(this.schema,[t],n):Rl(this.contents)&&this.contents.set(t,n)}setIn(t,n){md(t)?this.contents=n:this.contents==null?this.contents=bg(this.schema,Array.from(t),n):Rl(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Lr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Lr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new M_(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=Ps(this.contents,n??"",o);if(typeof i=="function")for(const{count:u,res:d}of o.anchors.values())i(d,u);return typeof a=="function"?oc(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Gme(this,t)}}function Rl(e){if(Bn(e))return!0;throw new Error("Expected a YAML collection as document contents")}class J6 extends Error{constructor(t,n,r,s){super(),this.name=t,this.code=r,this.message=s,this.pos=n}}class gd extends J6{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class Wme extends J6{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const gC=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){const o=Math.min(i-39,a.length-79);a="…"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,i))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… `),a=o+a}if(/[^ ]/.test(a)){let o=1;const c=n.linePos[1];(c==null?void 0:c.line)===r&&c.col>s&&(o=Math.max(1,Math.min(c.col-s,80-i)));const u=" ".repeat(i)+"^".repeat(o);n.message+=`: ${a} ${u} -`}};function nu(e,{flow:t,indicator:n,next:r,offset:s,onError:i,parentIndent:a,startOnNewline:o}){let c=!1,u=o,d=o,f="",h="",p=!1,m=!1,g=null,x=null,y=null,w=null,b=null,_=null,k=null;for(const S of e)switch(m&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&i(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),g&&(u&&S.type!=="comment"&&S.type!=="newline"&&i(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),S.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&S.source.includes(" ")&&(g=S),d=!0;break;case"comment":{d||i(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=S.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=S.source:(!_||n!=="seq-item-ind")&&(c=!0):h+=S.source,u=!0,p=!0,(x||y)&&(w=S),d=!0;break;case"anchor":x&&i(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&i(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),x=S,k??(k=S.offset),u=!1,d=!1,m=!0;break;case"tag":{y&&i(S,"MULTIPLE_TAGS","A node can have at most one tag"),y=S,k??(k=S.offset),u=!1,d=!1,m=!0;break}case n:(x||y)&&i(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),_&&i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),_=S,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&i(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=S,u=!1,d=!1;break}default:i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),u=!1,d=!1}const N=e[e.length-1],A=N?N.offset+N.source.length:s;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(u&&g.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&i(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:_,spaceBefore:c,comment:f,hasNewline:p,anchor:x,tag:y,newlineAfterProp:w,end:A,start:k??A}}function Pf(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Pf(t.key)||Pf(t.value))return!0}return!1;default:return!0}}function px(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Pf(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function e5(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const s=typeof r=="function"?r:(i,a)=>i===a||rn(i)&&rn(a)&&i.value===a.value;return t.some(i=>s(i.key,n))}const yC="All mapping items must start at the same column";function Wme({composeNode:e,composeEmptyNode:t},n,r,s,i){var d;const a=(i==null?void 0:i.nodeClass)??Os,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:g}=f,x=nu(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),y=!x.found;if(y){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&s(c,"BAD_INDENT",yC)),!x.anchor&&!x.tag&&!m){u=x.end,x.comment&&(o.comment?o.comment+=` -`+x.comment:o.comment=x.comment);continue}(x.newlineAfterProp||Pf(p))&&s(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=x.found)==null?void 0:d.indent)!==r.indent&&s(c,"BAD_INDENT",yC);n.atKey=!0;const w=x.end,b=p?e(n,p,x,s):t(n,w,h,null,x,s);n.schema.compat&&px(r.indent,p,s),n.atKey=!1,e5(n,o.items,b)&&s(w,"DUPLICATE_KEY","Map keys must be unique");const _=nu(m??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:s,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=_.end,_.found){y&&((g==null?void 0:g.type)==="block-map"&&!_.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&x.start<_.found.offset-1024&&s(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=g?e(n,g,_,s):t(n,c,m,null,_,s);n.schema.compat&&px(r.indent,g,s),c=k.range[2];const N=new Pr(b,k);n.options.keepSourceTokens&&(N.srcToken=f),o.items.push(N)}else{y&&s(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(b.comment?b.comment+=` -`+_.comment:b.comment=_.comment);const k=new Pr(b);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function Xme({composeNode:e,composeEmptyNode:t},n,r,s,i){var x;const a=r.start.source==="{",o=a?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(a?Os:ul),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let y=0;yi===a||rn(i)&&rn(a)&&i.value===a.value;return t.some(i=>s(i.key,n))}const yC="All mapping items must start at the same column";function qme({composeNode:e,composeEmptyNode:t},n,r,s,i){var d;const a=(i==null?void 0:i.nodeClass)??Os,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:g}=f,x=ru(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),y=!x.found;if(y){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&s(c,"BAD_INDENT",yC)),!x.anchor&&!x.tag&&!m){u=x.end,x.comment&&(o.comment?o.comment+=` +`+x.comment:o.comment=x.comment);continue}(x.newlineAfterProp||Pf(p))&&s(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=x.found)==null?void 0:d.indent)!==r.indent&&s(c,"BAD_INDENT",yC);n.atKey=!0;const w=x.end,b=p?e(n,p,x,s):t(n,w,h,null,x,s);n.schema.compat&&px(r.indent,p,s),n.atKey=!1,e5(n,o.items,b)&&s(w,"DUPLICATE_KEY","Map keys must be unique");const _=ru(m??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:s,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=_.end,_.found){y&&((g==null?void 0:g.type)==="block-map"&&!_.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&x.start<_.found.offset-1024&&s(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=g?e(n,g,_,s):t(n,c,m,null,_,s);n.schema.compat&&px(r.indent,g,s),c=k.range[2];const N=new Pr(b,k);n.options.keepSourceTokens&&(N.srcToken=f),o.items.push(N)}else{y&&s(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(b.comment?b.comment+=` +`+_.comment:b.comment=_.comment);const k=new Pr(b);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function Qme({composeNode:e,composeEmptyNode:t},n,r,s,i){var x;const a=r.start.source==="{",o=a?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(a?Os:ul),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let y=0;y0){const y=yh(m,g,n.options.strict,s);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[r.offset,g,y.offset]}else u.range=[r.offset,g,g];return u}function Ib(e,t,n,r,s,i){const a=n.type==="block-map"?Wme(e,t,n,r,i):n.type==="block-seq"?qme(e,t,n,r,i):Xme(e,t,n,r,i),o=a.constructor;return s==="!"||s===o.tagName?(a.tag=o.tagName,a):(s&&(a.tag=s),a)}function Qme(e,t,n,r,s){var h;const i=r.tag,a=i?t.directives.tagName(i.source,p=>s(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,g=p&&i?p.offset>i.offset?p:i:p??i;g&&(!m||m.offsetp.tag===a&&p.collection===o);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?s(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Ib(e,t,n,s,a)}const u=Ib(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(i,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Fn(d)?d:new ht(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Zme(e,t,n){const r=t.offset,s=Jme(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const i=s.mode===">"?ht.BLOCK_FOLDED:ht.BLOCK_LITERAL,a=t.source?ege(t.source):[];let o=a.length;for(let g=a.length-1;g>=0;--g){const x=a[g][1];if(x===""||x==="\r")o=g;else break}if(o===0){const g=s.chomp==="+"&&a.length>0?` +`+y.comment:u.comment=y.comment),u.range=[r.offset,g,y.offset]}else u.range=[r.offset,g,g];return u}function Ib(e,t,n,r,s,i){const a=n.type==="block-map"?qme(e,t,n,r,i):n.type==="block-seq"?Xme(e,t,n,r,i):Qme(e,t,n,r,i),o=a.constructor;return s==="!"||s===o.tagName?(a.tag=o.tagName,a):(s&&(a.tag=s),a)}function Zme(e,t,n,r,s){var h;const i=r.tag,a=i?t.directives.tagName(i.source,p=>s(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,g=p&&i?p.offset>i.offset?p:i:p??i;g&&(!m||m.offsetp.tag===a&&p.collection===o);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?s(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),Ib(e,t,n,s,a)}const u=Ib(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(i,"TAG_RESOLVE_FAILED",p),t.options))??u,f=Fn(d)?d:new ht(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Jme(e,t,n){const r=t.offset,s=ege(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const i=s.mode===">"?ht.BLOCK_FOLDED:ht.BLOCK_LITERAL,a=t.source?tge(t.source):[];let o=a.length;for(let g=a.length-1;g>=0;--g){const x=a[g][1];if(x===""||x==="\r")o=g;else break}if(o===0){const g=s.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let x=r+s.length;return t.source&&(x+=t.source.length),{value:g,type:i,comment:s.comment,range:[r,x,x]}}let c=t.indent+s.indent,u=t.offset+s.length,d=0;for(let g=0;gc&&(c=x.length);else{x.length=o;--g)a[g][0].length>c&&(o=g+1);let f="",h="",p=!1;for(let g=0;gc||y[0]===" "?(h===" "?h=` @@ -659,33 +659,33 @@ ${u} `+a[g][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const m=r+s.length+t.source.length;return{value:f,type:i,comment:s.comment,range:[r,m,m]}}function Jme({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=t[0],i=s[0];let a=0,o="",c=-1;for(let h=1;hn(r+h,p,m);switch(s){case"scalar":o=ht.PLAIN,c=nge(i,u);break;case"single-quoted-scalar":o=ht.QUOTE_SINGLE,c=rge(i,u);break;case"double-quoted-scalar":o=ht.QUOTE_DOUBLE,c=sge(i,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}const d=r+i.length,f=yh(a,d,t,n);return{value:c,type:o,comment:f.comment,range:[r,d,f.offset]}}function nge(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),t5(e)}function rge(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),t5(e.slice(1,-1)).replace(/''/g,"'")}function t5(e){let t,n;try{t=new RegExp(`(.*?)(?n(r+h,p,m);switch(s){case"scalar":o=ht.PLAIN,c=rge(i,u);break;case"single-quoted-scalar":o=ht.QUOTE_SINGLE,c=sge(i,u);break;case"double-quoted-scalar":o=ht.QUOTE_DOUBLE,c=ige(i,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}const d=r+i.length,f=yh(a,d,t,n);return{value:c,type:o,comment:f.comment,range:[r,d,f.offset]}}function rge(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),t5(e)}function sge(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),t5(e.slice(1,-1)).replace(/''/g,"'")}function t5(e){let t,n;try{t=new RegExp(`(.*?)(?i?e.slice(i,r+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function ige(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` +`)&&(n+=r>i?e.slice(i,r+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function age(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` `||r==="\r")&&!(r==="\r"&&e[t+2]!==` `);)r===` `&&(n+=` -`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}const age={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function oge(e,t,n,r){const s=e.substr(t,n),a=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(a)}catch{const o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}function n5(e,t,n,r){const{value:s,type:i,comment:a,range:o}=t.type==="block-scalar"?Zme(e,t,r):tge(t,e.options.strict,r),c=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Pi]:c?u=lge(e.schema,s,c,n,r):t.type==="scalar"?u=cge(e,s,t,r):u=e.schema[Pi];let d;try{const f=u.resolve(s,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=rn(f)?f:new ht(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new ht(s)}return d.range=o,d.source=s,i&&(d.type=i),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function lge(e,t,n,r,s){var o;if(n==="!")return e[Pi];const i=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)i.push(c);else return c;for(const c of i)if((o=c.test)!=null&&o.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Pi])}function cge({atKey:e,directives:t,schema:n},r,s,i){const a=n.tags.find(o=>{var c;return(o.default===!0||e&&o.default==="key")&&((c=o.test)==null?void 0:c.test(r))})||n[Pi];if(n.compat){const o=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[Pi];if(a.tag!==o.tag){const c=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${c} or ${u}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function uge(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let s=t[r];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++r];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++r];break}}return e}const dge={composeNode:r5,composeEmptyNode:j_};function r5(e,t,n,r){const s=e.atKey,{spaceBefore:i,comment:a,anchor:o,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=fge(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=n5(e,t,c,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Qme(dge,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=j_(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!rn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function j_(e,t,n,r,{spaceBefore:s,comment:i,anchor:a,tag:o,end:c},u){const d={type:"scalar",offset:uge(t,n,r),indent:-1,source:""},f=n5(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function fge({options:e},{offset:t,source:n,end:r},s){const i=new __(n.substring(1));i.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=yh(r,a,e.strict,s);return i.range=[t,a,o.offset],o.comment&&(i.comment=o.comment),i}function hge(e,t,{offset:n,start:r,value:s,end:i},a){const o=Object.assign({_directives:t},e),c=new gh(void 0,o),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=nu(r,{indicator:"doc-start",next:s??(i==null?void 0:i[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?r5(u,s,d,a):j_(u,d.end,r,null,d,a);const f=c.contents.range[2],h=yh(i,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Qu(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function bC(e){var s;let t="",n=!1,r=!1;for(let i=0;ir(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[Pi]:c?u=cge(e.schema,s,c,n,r):t.type==="scalar"?u=uge(e,s,t,r):u=e.schema[Pi];let d;try{const f=u.resolve(s,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=rn(f)?f:new ht(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new ht(s)}return d.range=o,d.source=s,i&&(d.type=i),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function cge(e,t,n,r,s){var o;if(n==="!")return e[Pi];const i=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)i.push(c);else return c;for(const c of i)if((o=c.test)!=null&&o.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Pi])}function uge({atKey:e,directives:t,schema:n},r,s,i){const a=n.tags.find(o=>{var c;return(o.default===!0||e&&o.default==="key")&&((c=o.test)==null?void 0:c.test(r))})||n[Pi];if(n.compat){const o=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[Pi];if(a.tag!==o.tag){const c=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${c} or ${u}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function dge(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let s=t[r];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++r];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++r];break}}return e}const fge={composeNode:r5,composeEmptyNode:j_};function r5(e,t,n,r){const s=e.atKey,{spaceBefore:i,comment:a,anchor:o,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=hge(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=n5(e,t,c,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Zme(fge,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=j_(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!rn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function j_(e,t,n,r,{spaceBefore:s,comment:i,anchor:a,tag:o,end:c},u){const d={type:"scalar",offset:dge(t,n,r),indent:-1,source:""},f=n5(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function hge({options:e},{offset:t,source:n,end:r},s){const i=new __(n.substring(1));i.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=yh(r,a,e.strict,s);return i.range=[t,a,o.offset],o.comment&&(i.comment=o.comment),i}function pge(e,t,{offset:n,start:r,value:s,end:i},a){const o=Object.assign({_directives:t},e),c=new gh(void 0,o),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=ru(r,{indicator:"doc-start",next:s??(i==null?void 0:i[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?r5(u,s,d,a):j_(u,d.end,r,null,d,a);const f=c.contents.range[2],h=yh(i,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Zu(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function bC(e){var s;let t="",n=!1,r=!1;for(let i=0;i{const a=Qu(n);i?this.warnings.push(new Gme(a,r,s)):this.errors.push(new md(a,r,s))},this.directives=new Lr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:s}=bC(this.prelude);if(r){const i=t.contents;if(n)t.comment=t.comment?`${t.comment} +`)+(a.substring(1)||" "),n=!0,r=!1;break;case"%":((s=e[i+1])==null?void 0:s[0])!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}class mge{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,s,i)=>{const a=Zu(n);i?this.warnings.push(new Wme(a,r,s)):this.errors.push(new gd(a,r,s))},this.directives=new Lr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:s}=bC(this.prelude);if(r){const i=t.contents;if(n)t.comment=t.comment?`${t.comment} ${r}`:r;else if(s||t.directives.docStart||!i)t.commentBefore=r;else if(Bn(i)&&!i.flow&&i.items.length>0){let a=i.items[0];Un(a)&&(a=a.key);const o=a.commentBefore;a.commentBefore=o?`${r} ${o}`:r}else{const a=i.commentBefore;i.commentBefore=a?`${r} -${a}`:r}}if(n){for(let i=0;i{const i=Qu(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=hge(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new md(Qu(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new md(Qu(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=yh(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new md(Qu(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),s=new gh(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const s5="\uFEFF",i5="",a5="",mx="";function mge(e){switch(e){case s5:return"byte-order-mark";case i5:return"doc-mode";case a5:return"flow-error-end";case mx:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:r}}if(n){for(let i=0;i{const i=Zu(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=pge(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new gd(Zu(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new gd(Zu(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=yh(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new gd(Zu(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),s=new gh(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const s5="\uFEFF",i5="",a5="",mx="";function gge(e){switch(e){case s5:return"byte-order-mark";case i5:return"doc-mode";case a5:return"flow-error-end";case mx:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Xs(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const EC=new Set("0123456789ABCDEFabcdef"),gge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Np=new Set(",[]{}"),yge=new Set(` ,[]{} -\r `),Rb=e=>!e||yge.has(e);class bge{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`:case"\r":case" ":return!0;default:return!1}}const EC=new Set("0123456789ABCDEFabcdef"),yge=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Np=new Set(",[]{}"),bge=new Set(` ,[]{} +\r `),Rb=e=>!e||bge.has(e);class Ege{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){const s=this.buffer[r+t+1];if(s===` `||!s&&!this.atEnd)return t+r+1}return n===` @@ -700,19 +700,19 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus `&&i>=this.pos&&i+1+n>o)t=i;else break}while(!0);return yield mx,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const i=this.buffer[r+1];if(Xs(i)||t&&Np.has(i))break;n=r}else if(Xs(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===` `?(r+=1,s=` `,i=this.buffer[r+1]):n=r),i==="#"||t&&Np.has(i))break;if(s===` -`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Np.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield mx,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Rb),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Xs(r)||n&&Np.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Xs(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(gge.has(n))n=this.buffer[++t];else if(n==="%"&&EC.has(this.buffer[t+1])&&EC.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` +`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Np.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield mx,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Rb),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Xs(r)||n&&Np.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Xs(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(yge.has(n))n=this.buffer[++t];else if(n==="%"&&EC.has(this.buffer[t+1])&&EC.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Ege{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[i]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function xg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&wC(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&xC(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class xge{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[i]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function xg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&wC(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&xC(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(i&&n.sep&&!n.value){const o=[];for(let c=0;ct.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Pa(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(o5(n.key)&&!Pa(n.sep,"newline")){const o=Ol(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Pa(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=Ol(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Pa(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Pa(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const s=t.items[t.items.length-2],i=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(i)){xg(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Pa(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0:r.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=Sp(r),i=Ol(s);wC(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` `)+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=Sp(t),r=Ol(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Sp(t),r=Ol(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.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 wge(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ege||null,prettyErrors:t}}function vge(e,t={}){const{lineCounter:n,prettyErrors:r}=wge(t),s=new xge(n==null?void 0:n.addNewLine),i=new pge(t);let a=null;for(const o of i.compose(s.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new md(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(gC(e,n)),a.warnings.forEach(gC(e,n))),a}function _ge(e,t,n){let r;const s=vge(e,n);if(!s)return null;if(s.warnings.forEach(i=>L6(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function kge(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return fh(e)&&!r?e.toString(n):new gh(e,r,n).toString(n)}const l5=new Set(["local","sqlite","mysql","postgresql"]),c5=new Set(["local","opensearch","redis","viking","mem0"]),u5=new Set(["opensearch","viking","context_search"]),d5=new Set(["apmplus","cozeloop","tls"]),f5=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Nge=new Set(["llm","sequential","parallel","loop","a2a"]);function Et(e,t=""){return typeof e=="string"?e:t}function Rs(e){return e===!0}function Kd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function h5(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Et(t.name),description:Et(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function _c(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function p5(e){return typeof e=="string"&&Nge.has(e)?e:"llm"}function m5(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function g5(e){const t=e&&typeof e=="object"?e:{};return{enabled:Rs(t.enabled),registrySpaceId:Et(t.registrySpaceId),registryTopK:Et(t.registryTopK),registryRegion:Et(t.registryRegion),registryEndpoint:Et(t.registryEndpoint)}}function y5(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=n.memory&&typeof n.memory=="object"?n.memory:{},s=g5(n.a2aRegistry),i=p5(n.agentType),a=s.enabled&&i==="llm"?"a2a":i;return{...jr(),name:Et(n.name),description:Et(n.description),instruction:Et(n.instruction),agentType:a,maxIterations:m5(n.maxIterations),a2aUrl:Et(n.a2aUrl),modelName:Et(n.modelName),modelProvider:Et(n.modelProvider),modelApiBase:Et(n.modelApiBase),builtinTools:Kd(n.builtinTools).filter(o=>f5.has(o)),customTools:h5(n.customTools),memory:{shortTerm:Rs(r.shortTerm),longTerm:Rs(r.longTerm)},shortTermBackend:_c(n.shortTermBackend,l5,"local"),longTermBackend:_c(n.longTermBackend,c5,"local"),autoSaveSession:Rs(n.autoSaveSession),knowledgebase:Rs(n.knowledgebase),knowledgebaseBackend:_c(n.knowledgebaseBackend,u5,Fc),knowledgebaseIndex:Et(n.knowledgebaseIndex),tracing:Rs(n.tracing),tracingExporters:Kd(n.tracingExporters).filter(o=>d5.has(o)),a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,subAgents:y5(n.subAgents),selectedSkills:b5(n)}}):[]}function b5(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},s=Et(r.source),i=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=Et(r.name)||Et(r.slug)||Et(r.skillName)||Et(r.skillId)||"skill",o=Et(r.folder)||a,c=Et(r.description);if(i==="skillhub"){const f=Et(r.slug);if(!f)continue;t.push({source:i,folder:o,name:a,description:c,slug:f,namespace:Et(r.namespace)||"public"});continue}if(i==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},g=Et(m.path),x=Et(m.content);return g?{path:g,content:x}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:i,folder:o,name:a,description:c,localFiles:h});continue}const u=Et(r.skillSpaceId),d=Et(r.skillId);!u||!d||t.push({source:i,folder:o,name:a,description:c,skillSpaceId:u,skillSpaceName:Et(r.skillSpaceName),skillId:d,version:Et(r.version)})}return t}function D_(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=g5(t.a2aRegistry),i=p5(t.agentType),a=s.enabled&&i==="llm"?"a2a":i,o=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:Et(u.name),transport:d,url:Et(u.url),authToken:Et(u.authToken),command:Et(u.command),args:Kd(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{...jr(),name:Et(t.name)||"my_agent",description:Et(t.description),instruction:Et(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:m5(t.maxIterations),a2aUrl:Et(t.a2aUrl),modelName:Et(t.modelName),modelProvider:Et(t.modelProvider),modelApiBase:Et(t.modelApiBase),builtinTools:Kd(t.builtinTools).filter(c=>f5.has(c)),customTools:h5(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:Rs(n.shortTerm),longTerm:Rs(n.longTerm)},shortTermBackend:_c(t.shortTermBackend,l5,"local"),longTermBackend:_c(t.longTermBackend,c5,"local"),autoSaveSession:Rs(t.autoSaveSession),knowledgebase:Rs(t.knowledgebase),knowledgebaseBackend:_c(t.knowledgebaseBackend,u5,Fc),knowledgebaseIndex:Et(t.knowledgebaseIndex),tracing:Rs(t.tracing),tracingExporters:Kd(t.tracingExporters).filter(c=>d5.has(c)),deployment:{feishuEnabled:Rs(r.feishuEnabled)},subAgents:y5(t.subAgents),selectedSkills:b5(t)}}function E5(e){var n,r,s,i,a,o,c,u,d,f,h,p,m,g,x,y,w,b;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const _={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(_.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),_.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||ui.topK,_.registryRegion=((i=e.a2aRegistry.registryRegion)==null?void 0:i.trim())||ui.region,_.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||ui.endpoint,t.a2aRegistry=_}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.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(_=>({name:_.name,description:_.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(_=>{var N,A,S,C;const k={name:_.name,transport:_.transport};return(N=_.url)!=null&&N.trim()&&(k.url=_.url.trim()),(A=_.authToken)!=null&&A.trim()&&(k.authToken=_.authToken.trim()),(S=_.command)!=null&&S.trim()&&(k.command=_.command.trim()),(C=_.args)!=null&&C.length&&(k.args=_.args),k})),((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",(g=e.knowledgebaseIndex)!=null&&g.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((x=e.tracingExporters)!=null&&x.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(w=e.selectedSkills)!=null&&w.length&&(t.selectedSkills=e.selectedSkills.map(_=>{const k={source:_.source,name:_.name,folder:_.folder};return _.description&&(k.description=_.description),_.source==="skillhub"?(k.slug=_.slug,k.namespace=_.namespace??"public"):_.source==="local"?k.localFiles=_.localFiles??[]:(k.skillSpaceId=_.skillSpaceId,k.skillSpaceName=_.skillSpaceName,k.skillId=_.skillId,_.version&&(k.version=_.version)),k})),(b=e.subAgents)!=null&&b.length&&(t.subAgents=e.subAgents.map(E5)),t}function Sge(e){return`# VeADK Agent 结构配置 +`,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=Sp(t),r=Ol(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=Sp(t),r=Ol(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.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 vge(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new xge||null,prettyErrors:t}}function _ge(e,t={}){const{lineCounter:n,prettyErrors:r}=vge(t),s=new wge(n==null?void 0:n.addNewLine),i=new mge(t);let a=null;for(const o of i.compose(s.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new gd(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(gC(e,n)),a.warnings.forEach(gC(e,n))),a}function kge(e,t,n){let r;const s=_ge(e,n);if(!s)return null;if(s.warnings.forEach(i=>L6(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function Nge(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return fh(e)&&!r?e.toString(n):new gh(e,r,n).toString(n)}const l5=new Set(["local","sqlite","mysql","postgresql"]),c5=new Set(["local","opensearch","redis","viking","mem0"]),u5=new Set(["opensearch","viking","context_search"]),d5=new Set(["apmplus","cozeloop","tls"]),f5=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Sge=new Set(["llm","sequential","parallel","loop","a2a"]);function Et(e,t=""){return typeof e=="string"?e:t}function Rs(e){return e===!0}function Yd(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function h5(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:Et(t.name),description:Et(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function kc(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function p5(e){return typeof e=="string"&&Sge.has(e)?e:"llm"}function m5(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function g5(e){const t=e&&typeof e=="object"?e:{};return{enabled:Rs(t.enabled),registrySpaceId:Et(t.registrySpaceId),registryTopK:Et(t.registryTopK),registryRegion:Et(t.registryRegion),registryEndpoint:Et(t.registryEndpoint)}}function y5(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=n.memory&&typeof n.memory=="object"?n.memory:{},s=g5(n.a2aRegistry),i=p5(n.agentType),a=s.enabled&&i==="llm"?"a2a":i;return{...jr(),name:Et(n.name),description:Et(n.description),instruction:Et(n.instruction),agentType:a,maxIterations:m5(n.maxIterations),a2aUrl:Et(n.a2aUrl),modelName:Et(n.modelName),modelProvider:Et(n.modelProvider),modelApiBase:Et(n.modelApiBase),builtinTools:Yd(n.builtinTools).filter(o=>f5.has(o)),customTools:h5(n.customTools),memory:{shortTerm:Rs(r.shortTerm),longTerm:Rs(r.longTerm)},shortTermBackend:kc(n.shortTermBackend,l5,"local"),longTermBackend:kc(n.longTermBackend,c5,"local"),autoSaveSession:Rs(n.autoSaveSession),knowledgebase:Rs(n.knowledgebase),knowledgebaseBackend:kc(n.knowledgebaseBackend,u5,Uc),knowledgebaseIndex:Et(n.knowledgebaseIndex),tracing:Rs(n.tracing),tracingExporters:Yd(n.tracingExporters).filter(o=>d5.has(o)),a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,subAgents:y5(n.subAgents),selectedSkills:b5(n)}}):[]}function b5(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},s=Et(r.source),i=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=Et(r.name)||Et(r.slug)||Et(r.skillName)||Et(r.skillId)||"skill",o=Et(r.folder)||a,c=Et(r.description);if(i==="skillhub"){const f=Et(r.slug);if(!f)continue;t.push({source:i,folder:o,name:a,description:c,slug:f,namespace:Et(r.namespace)||"public"});continue}if(i==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},g=Et(m.path),x=Et(m.content);return g?{path:g,content:x}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:i,folder:o,name:a,description:c,localFiles:h});continue}const u=Et(r.skillSpaceId),d=Et(r.skillId);!u||!d||t.push({source:i,folder:o,name:a,description:c,skillSpaceId:u,skillSpaceName:Et(r.skillSpaceName),skillId:d,version:Et(r.version)})}return t}function D_(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=g5(t.a2aRegistry),i=p5(t.agentType),a=s.enabled&&i==="llm"?"a2a":i,o=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:Et(u.name),transport:d,url:Et(u.url),authToken:Et(u.authToken),command:Et(u.command),args:Yd(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{...jr(),name:Et(t.name)||"my_agent",description:Et(t.description),instruction:Et(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:m5(t.maxIterations),a2aUrl:Et(t.a2aUrl),modelName:Et(t.modelName),modelProvider:Et(t.modelProvider),modelApiBase:Et(t.modelApiBase),builtinTools:Yd(t.builtinTools).filter(c=>f5.has(c)),customTools:h5(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:Rs(n.shortTerm),longTerm:Rs(n.longTerm)},shortTermBackend:kc(t.shortTermBackend,l5,"local"),longTermBackend:kc(t.longTermBackend,c5,"local"),autoSaveSession:Rs(t.autoSaveSession),knowledgebase:Rs(t.knowledgebase),knowledgebaseBackend:kc(t.knowledgebaseBackend,u5,Uc),knowledgebaseIndex:Et(t.knowledgebaseIndex),tracing:Rs(t.tracing),tracingExporters:Yd(t.tracingExporters).filter(c=>d5.has(c)),deployment:{feishuEnabled:Rs(r.feishuEnabled)},subAgents:y5(t.subAgents),selectedSkills:b5(t)}}function E5(e){var n,r,s,i,a,o,c,u,d,f,h,p,m,g,x,y,w,b;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const _={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(_.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),_.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||ui.topK,_.registryRegion=((i=e.a2aRegistry.registryRegion)==null?void 0:i.trim())||ui.region,_.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||ui.endpoint,t.a2aRegistry=_}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.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(_=>({name:_.name,description:_.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(_=>{var N,A,S,C;const k={name:_.name,transport:_.transport};return(N=_.url)!=null&&N.trim()&&(k.url=_.url.trim()),(A=_.authToken)!=null&&A.trim()&&(k.authToken=_.authToken.trim()),(S=_.command)!=null&&S.trim()&&(k.command=_.command.trim()),(C=_.args)!=null&&C.length&&(k.args=_.args),k})),((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",(g=e.knowledgebaseIndex)!=null&&g.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((x=e.tracingExporters)!=null&&x.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(y=e.deployment)!=null&&y.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(w=e.selectedSkills)!=null&&w.length&&(t.selectedSkills=e.selectedSkills.map(_=>{const k={source:_.source,name:_.name,folder:_.folder};return _.description&&(k.description=_.description),_.source==="skillhub"?(k.slug=_.slug,k.namespace=_.namespace??"public"):_.source==="local"?k.localFiles=_.localFiles??[]:(k.skillSpaceId=_.skillSpaceId,k.skillSpaceName=_.skillSpaceName,k.skillId=_.skillId,_.version&&(k.version=_.version)),k})),(b=e.subAgents)!=null&&b.length&&(t.subAgents=e.subAgents.map(E5)),t}function Tge(e){return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+kge(E5(e))}function Tge(e){const t=_ge(e);return D_(t)}const Age=[{kind:"custom",icon:zz,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:Az,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:_z,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Vz,title:"工作流",desc:"敬请期待",disabled:!0}];function Cge({onSelect:e,onImport:t}){const n=E.useRef(null),[r,s]=E.useState(""),i=Age.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const c=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!c)try{const d=await c.text();t(Tge(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return l.jsx(_6,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:i,footer:l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[l.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[l.jsx($z,{}),"导入 YAML 配置"]}),r&&l.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),l.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Ige="modulepreload",Rge=function(e){return"/"+e},vC={},kc=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Rge(c),c in vC)return;vC[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":Ige,u||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),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 i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function x5(e){const t=new Map,n={};for(const r of e){for(const s of r.env){const i=t.get(s.key);(!i||s.required&&!i.required)&&t.set(s.key,s)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Oge(e,t){return x5([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function w5(e,t){const n=new Map;for(const r of e){const s=t[r.key]??"";s.trim()&&n.set(r.key,s)}return[...n].map(([r,s])=>({key:r,value:s}))}function _C(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const Lge="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",Mge=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function jge(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function kn(e,t){e.push(t&255,t>>>8&255)}function ss(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const kC=2048,Ob=20,NC=0;function Dge(e){const t=new TextEncoder,n=[],r=[];let s=0;for(const p of e){const m=t.encode(p.path),g=t.encode(p.content),x=jge(g),y=g.length,w=[];ss(w,67324752),kn(w,Ob),kn(w,kC),kn(w,NC),kn(w,0),kn(w,0),ss(w,x),ss(w,y),ss(w,y),kn(w,m.length),kn(w,0);const b=Uint8Array.from(w);n.push(b,m,g),r.push({nameBytes:m,dataBytes:g,crc:x,size:y,offset:s}),s+=b.length+m.length+g.length}const i=s,a=[];let o=0;for(const p of r){const m=[];ss(m,33639248),kn(m,Ob),kn(m,Ob),kn(m,kC),kn(m,NC),kn(m,0),kn(m,0),ss(m,p.crc),ss(m,p.size),ss(m,p.size),kn(m,p.nameBytes.length),kn(m,0),kn(m,0),kn(m,0),kn(m,0),ss(m,0),ss(m,p.offset);const g=Uint8Array.from(m);a.push(g,p.nameBytes),o+=g.length+p.nameBytes.length}const c=[];ss(c,101010256),kn(c,0),kn(c,0),kn(c,r.length),kn(c,r.length),ss(c,o),ss(c,i),kn(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 Pge=E.lazy(()=>kc(()=>import("./CodeEditor-DMEaV9T5.js"),[]));function Bge(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function Fge(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function v5({project:e,open:t,onClose:n,onChange:r}){var m;const[s,i]=E.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=E.useState(new Set),c=E.useRef(null),u=E.useMemo(()=>Bge(e.files),[e.files]),d=e.files.find(g=>g.path===s)??null;if(E.useEffect(()=>{var y;if(!t)return;const g=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const x=w=>{w.key==="Escape"&&n()};return window.addEventListener("keydown",x),()=>{document.body.style.overflow=g,window.removeEventListener("keydown",x)}},[n,t]),E.useEffect(()=>{d||e.files.length===0||i(e.files[0].path)},[e.files,d]),!t)return null;function f(g){o(x=>{const y=new Set(x);return y.has(g)?y.delete(g):y.add(g),y})}function h(g,x,y){return Fge(g).map(w=>{const b=y?`${y}/${w.name}`:w.name;if(!(w.children.size>0&&w.path===void 0)&&w.path)return l.jsxs("button",{type:"button",className:`code-browser-file${s===w.path?" is-active":""}`,style:{paddingLeft:`${12+x*16}px`},onClick:()=>i(w.path??null),title:w.path,children:[l.jsx(PS,{"aria-hidden":"true"}),l.jsx("span",{children:w.name})]},b);const k=a.has(b);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+x*16}px`},onClick:()=>f(b),"aria-expanded":!k,children:[l.jsx(Ms,{className:k?"":"is-open","aria-hidden":"true"}),l.jsx(tM,{"aria-hidden":"true"}),l.jsx("span",{children:w.name})]}),!k&&h(w,x+1,b)]},b)})}function p(g){d&&r({...e,files:e.files.map(x=>x.path===d.path?{...x,content:g}:x)})}return Us.createPortal(l.jsx("div",{className:"code-browser-backdrop",onMouseDown:g=>{g.target===g.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[l.jsxs("header",{className:"code-browser-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:l.jsx(Qw,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"code-browser-title",children:"项目代码"}),l.jsx("p",{children:e.name||"Agent 项目"})]})]}),l.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:l.jsx(Zr,{"aria-hidden":"true"})})]}),l.jsxs("div",{className:"code-browser-workspace",children:[l.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[l.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",l.jsx("span",{children:e.files.length})]}),l.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):l.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),l.jsxs("main",{className:"code-browser-main",children:[l.jsxs("div",{className:"code-browser-path",children:[l.jsx(PS,{"aria-hidden":"true"}),l.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),l.jsx("div",{className:"code-browser-editor",children:d?l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:l.jsx(Pge,{value:d.content,path:d.path,onChange:p})}):l.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function Uge({project:e,onChange:t,className:n=""}){const[r,s]=E.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[l.jsx(Qw,{"aria-hidden":"true"}),l.jsx("span",{children:"查看源码"})]}),l.jsx(v5,{project:e,open:r,onClose:()=>s(!1),onChange:t})]})}function wg({message:e,className:t="",onRetry:n,retryLabel:r="重试部署"}){const[s,i]=E.useState(!1),[a,o]=E.useState(!1),[c,u]=E.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1500)}catch{o(!1)}},f=async()=>{if(!(!n||c)){u(!0);try{await n()}finally{u(!1)}}};return l.jsxs("div",{className:`deploy-error-message${s?" is-expanded":""}${t?` ${t}`:""}`,children:[l.jsx("p",{className:"deploy-error-message-text",children:e}),l.jsxs("div",{className:"deploy-error-message-actions",children:[n&&l.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:c,onClick:()=>void f(),children:[c?l.jsx(Kt,{className:"spin"}):l.jsx(Dz,{}),c?"重试中…":r]}),l.jsx("button",{type:"button",title:s?"收起错误信息":"展开完整错误信息","aria-label":s?"收起错误信息":"展开完整错误信息",onClick:()=>i(h=>!h),children:s?l.jsx(Iz,{}):l.jsx(gc,{})}),l.jsx("button",{type:"button",title:a?"已复制":"复制完整错误信息","aria-label":a?"已复制":"复制完整错误信息",onClick:()=>void d(),children:a?l.jsx(pi,{}):l.jsx(Zw,{})})]})]})}Qr.registerLanguage("python",Oj);Qr.registerLanguage("typescript",Vj);Qr.registerLanguage("javascript",Sj);Qr.registerLanguage("json",Tj);Qr.registerLanguage("yaml",Kj);Qr.registerLanguage("markdown",Rj);Qr.registerLanguage("bash",xj);Qr.registerLanguage("ini",wj);Qr.registerLanguage("dockerfile",NZ);Qr.registerLanguage("makefile",Ij);const $ge=E.lazy(()=>kc(()=>import("./CodeEditor-DMEaV9T5.js"),[])),Ia=()=>{};function Hge({open:e,isUpdate:t,onCancel:n,onConfirm:r}){const s=E.useRef(null);return E.useEffect(()=>{var o;if(!e)return;const i=document.body.style.overflow;document.body.style.overflow="hidden",(o=s.current)==null||o.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=i,window.removeEventListener("keydown",a)}},[n,e]),e?Us.createPortal(l.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:i=>{i.target===i.currentTarget&&n()},children:l.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:[l.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:l.jsx(Uz,{})}),l.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),l.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:l.jsx(Zr,{"aria-hidden":"true"})})]}),l.jsx("div",{className:"pp-confirm-body",children:l.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),l.jsxs("footer",{className:"pp-confirm-actions",children:[l.jsx("button",{ref:s,type:"button",onClick:n,children:"取消"}),l.jsx("button",{type:"button",className:"is-primary",onClick:r,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}const zge={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"},SC={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function TC(e){return e.replace(/&/g,"&").replace(//g,">")}function Vge(e){const n=(e.split("/").pop()??e).toLowerCase();if(SC[n])return SC[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const s=n.slice(r+1);return zge[s]??null}function Kge(e,t){try{const n=Vge(t);return n&&Qr.getLanguage(n)?Qr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?Qr.highlightAuto(e).value:TC(e)}catch{return TC(e)}}const Yge=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],Gge=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function Wge(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function qge(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function Xge(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function Qge({left:e,right:t}){const[n,r]=E.useState(null);return E.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),i=document.getElementById("veadk-page-header-actions");s&&i&&r({left:s,right:i})},[]),n?l.jsxs(l.Fragment,{children:[Us.createPortal(e,n.left),Us.createPortal(t,n.right)]}):l.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function U0({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:r,agentName:s,agentCount:i,releaseConfiguration:a,onChange:o,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentRuntimeId:h,onDeploymentStarted:p,onDeploymentTaskChange:m,feishuEnabled:g=!1,onFeishuEnabledChange:x,deploymentEnv:y=[],deploymentEnvValues:w={},onDeploymentEnvChange:b,network:_,onNetworkChange:k,deployRegion:N="cn-beijing",onDeployRegionChange:A,onBack:S,backLabel:C="返回配置",onExportYaml:R,deploymentPrimaryPane:O,deployDisabled:F=!1}){var Xt,Ln,Mn;const q=typeof o=="function",L=f.includes("更新"),D=O?Gge:Yge,[T,M]=E.useState(((Ln=(Xt=e==null?void 0:e.files)==null?void 0:Xt[0])==null?void 0:Ln.path)??null),[j,U]=E.useState(new Set),[I,K]=E.useState(!1),[W,B]=E.useState(""),[ie,Q]=E.useState(!1),[ee,ce]=E.useState(!1),[J,fe]=E.useState(!1),[te,ge]=E.useState(!1),[we,Z]=E.useState(null),[me,Ne]=E.useState(null),[Ie,We]=E.useState({}),[Ce,et]=E.useState(null),[Ge,Xe]=E.useState(!1),[xt,gt]=E.useState([]),[At,ut]=E.useState(!1),[X,ne]=E.useState(!1),he=E.useRef(!0),Te=ue=>l.jsxs("div",{className:"pp-network-region",onKeyDown:_e=>{_e.key==="Escape"&&ne(!1)},children:[ue&&l.jsx("span",{children:"发布区域"}),l.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":X,disabled:ie||L||!A,onClick:()=>ne(_e=>!_e),children:[l.jsx("span",{children:N==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),l.jsx(Xw,{className:`pp-region-chevron${X?" is-open":""}`})]}),X&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>ne(!1)}),l.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(_e=>{const ve=_e.value===N;return l.jsxs("button",{type:"button",role:"option","aria-selected":ve,className:`pp-region-option${ve?" is-selected":""}`,onClick:()=>{A==null||A(_e.value),ne(!1)},children:[l.jsx("span",{children:_e.label}),ve&&l.jsx(pi,{"aria-hidden":"true"})]},_e.value)})})]})]});E.useEffect(()=>(he.current=!0,()=>{he.current=!1}),[]),E.useEffect(()=>{if(!J)return;const ue=document.body.style.overflow;document.body.style.overflow="hidden";const _e=ve=>{ve.key==="Escape"&&fe(!1)};return window.addEventListener("keydown",_e),()=>{document.body.style.overflow=ue,window.removeEventListener("keydown",_e)}},[J]);const He=E.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:Wge(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return l.jsx("div",{className:"pp-error",children:"项目数据无效"});const qe=e.files.find(ue=>ue.path===T)??null,Ut=(_==null?void 0:_.mode)??"public",Ye=Oge(g?[...y,...$u]:y,w),De=Ye.length+xt.length;function Be(ue){U(_e=>{const ve=new Set(_e);return ve.has(ue)?ve.delete(ue):ve.add(ue),ve})}function Ct(ue,_e){o&&(o({...e,files:ue}),_e!==void 0&&M(_e))}function un(ue){qe&&Ct(e.files.map(_e=>_e.path===qe.path?{..._e,content:ue}:_e))}function $t(){const ue=W.trim();if(K(!1),B(""),!!ue){if(e.files.some(_e=>_e.path===ue)){M(ue);return}Ct([...e.files,{path:ue,content:""}],ue)}}function wn(){if(!qe)return;const ue=window.prompt("重命名文件",qe.path),_e=ue==null?void 0:ue.trim();!_e||_e===qe.path||e.files.some(ve=>ve.path===_e)||Ct(e.files.map(ve=>ve.path===qe.path?{...ve,path:_e}:ve),_e)}function Fe(){var _e;if(!qe)return;const ue=e.files.filter(ve=>ve.path!==qe.path);Ct(ue,((_e=ue[0])==null?void 0:_e.path)??null)}function dt(ue,_e){gt(ve=>ve.map(ye=>ye.id===ue?{...ye,..._e}:ye))}function Lt(ue){gt(_e=>_e.filter(ve=>ve.id!==ue))}function _t(){gt(ue=>[...ue,Xge()])}function be(ue){k&&k(ue==="public"?void 0:{..._??{mode:ue},mode:ue})}function Ve(ue){k==null||k({..._??{mode:"private"},...ue})}function st(){const ue=new Map(xt.map(ve=>({key:ve.key.trim(),value:ve.value})).filter(ve=>ve.key.length>0).map(ve=>[ve.key,ve.value])),_e=g?[...y,...$u]:y;for(const ve of w5(_e,w))ue.set(ve.key,ve.value);return[...ue].map(([ve,ye])=>({key:ve,value:ye}))}async function sn(){if(!(!x||ie||te)){Z(null),ge(!0);try{await x(!g)}catch(ue){he.current&&Z(`更新飞书配置失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{he.current&&ge(!1)}}}async function an(){var _e;if(!c||ie||F)return;if(Ut!=="public"&&!((_e=_==null?void 0:_.vpcId)!=null&&_e.trim())){Z("使用 VPC 网络时,请填写 VPC ID。");return}const ue=_C(y,w);if(ue){const ve=y.find(ye=>ye.key===ue.key);Z(`请返回配置页填写 ${(ve==null?void 0:ve.comment)||(ve==null?void 0:ve.key)}(${ve==null?void 0:ve.key})。`);return}if(g){const ve=_C($u,w);if(ve){const ye=$u.find(nt=>nt.key===ve.key);Z(`启用飞书后,请填写${(ye==null?void 0:ye.comment)||(ye==null?void 0:ye.key)}。`);return}}ce(!0)}async function Ht(){if(!c||ie)return;ce(!1);const ue=st();he.current&&(Z(null),Ne(null),We({}),et(null),Q(!0));const _e=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let ve=(s==null?void 0:s.trim())||e.name||"生成中…";const ye=Date.now(),nt={id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"running",phase:"prepare",label:"准备部署",agentDraft:r};m==null||m(nt),p==null||p(nt);try{const Qe=await c(e,ct=>{var ot;ct.runtimeName&&(ve=ct.runtimeName),he.current&&(We(oe=>({...oe,[ct.phase]:ct})),et(ct.phase)),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"running",phase:ct.phase,label:((ot=D.find(oe=>oe.phase===ct.phase))==null?void 0:ot.label)??ct.phase,message:ct.message,pct:ct.pct})},g?{taskId:_e,im:{feishu:{enabled:!0}},envs:ue}:{taskId:_e,envs:ue});he.current&&(Ne(Qe),et(null)),await(d==null?void 0:d(Qe)),m==null||m({id:_e,runtimeName:Qe.agentName||ve,runtimeId:Qe.runtimeId||h,region:Qe.region||N,startedAt:ye,status:"success",phase:"complete",label:"部署完成"})}catch(Qe){const ct=Qe instanceof Error?Qe.message:String(Qe);if(Qe instanceof DOMException&&Qe.name==="AbortError"){he.current&&(Z(null),et(null)),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}he.current&&Z(ct),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"error",label:"部署失败",message:ct,retry:an})}finally{he.current&&Q(!1)}}function zt(){ce(!1)}async function Bt(){if(!(!me||Ge)){Xe(!0),Z(null);try{const{addConnection:ue,addRuntimeConnection:_e,remoteAppId:ve,loadConnections:ye}=await kc(async()=>{const{addConnection:ct,addRuntimeConnection:ot,remoteAppId:oe,loadConnections:Ze}=await Promise.resolve().then(()=>XS);return{addConnection:ct,addRuntimeConnection:ot,remoteAppId:oe,loadConnections:Ze}},void 0),{probeRuntimeApps:nt}=await kc(async()=>{const{probeRuntimeApps:ct}=await Promise.resolve().then(()=>hV);return{probeRuntimeApps:ct}},void 0);let Qe;if(me.runtimeId){const ct=me.region??"cn-beijing",ot=await nt(me.runtimeId,ct)??[];Qe=_e(me.runtimeId,me.agentName,ct,ot,ot.length>0?{[ot[0]]:me.agentName}:void 0,me.version)}else Qe=await ue(me.agentName,me.url,me.apikey,"");if(Qe.apps.length===0)Z("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const ct={[Qe.apps[0]]:me.agentName},ot={...Qe,appLabels:{...Qe.appLabels??{},...ct}},Ze=ye().map(it=>it.id===Qe.id?ot:it);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Ze));const{registerConnections:It}=await kc(async()=>{const{registerConnections:it}=await Promise.resolve().then(()=>XS);return{registerConnections:it}},void 0);if(It(Ze),u){const it=ve(Qe.id,Qe.apps[0]);u(it,me.agentName)}else alert(`🎉 Agent "${me.agentName}" 已添加到左上角下拉列表!`)}}catch(ue){Z(`添加 Agent 失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{Xe(!1)}}}function qt(){const ue=Dge(e.files),_e=URL.createObjectURL(ue),ve=document.createElement("a");ve.href=_e,ve.download=`${e.name||"project"}.zip`,document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(_e)}function vn(ue,_e,ve){return qge(ue).map(ye=>{const nt=ve?`${ve}/${ye.name}`:ye.name,Qe=ye.path!==void 0,ct={paddingLeft:8+_e*14};if(Qe){const oe=ye.path===T;return l.jsxs("button",{type:"button",className:`pp-row pp-file${oe?" pp-active":""}`,style:ct,onClick:()=>M(ye.path),title:ye.path,children:[l.jsx(mz,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:ye.name})]},nt)}const ot=j.has(nt);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"pp-row pp-folder",style:ct,onClick:()=>Be(nt),children:[l.jsx(Ms,{className:`pp-ic pp-chevron${ot?"":" pp-open"}`}),l.jsx(tM,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:ye.name})]}),!ot&&vn(ye,_e+1,nt)]},nt)})}return l.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${O?" has-primary-pane":""}`,children:[c&&!t&&l.jsx(Qge,{left:l.jsxs("div",{className:"pp-toolbar-left",children:[S&&l.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:S,children:[l.jsx(qw,{className:"pp-ic"}),C]}),l.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",i&&i>1?` 等 ${i} 个智能体`:""]})]}),right:null}),l.jsxs("div",{className:"pp-body",children:[c&&!O&&l.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:l.jsxs("div",{className:"pp-release-preview",children:[l.jsxs("div",{className:"pp-flow-thumbnail",children:[r&&l.jsx(yg,{draft:r,direction:"horizontal",selectedPath:[],onSelect:Ia,onAdd:Ia,onInsert:Ia,onDelete:Ia,readOnly:!0,interactivePreview:!0}),l.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>fe(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:l.jsx(gc,{"aria-hidden":!0})})]}),l.jsxs("div",{className:"pp-release-info",children:[l.jsxs("div",{className:"pp-release-info-main",children:[l.jsx("h2",{children:s||e.name||"未命名 Agent"}),(r==null?void 0:r.description)&&l.jsx("p",{className:"pp-release-description",title:r.description,children:r.description}),l.jsxs("dl",{className:"pp-release-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Agent 数量"}),l.jsx("dd",{children:i??1})]}),a&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:a.modelName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"描述"}),l.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"系统提示词"}),l.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"优化选项"}),l.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),l.jsxs("div",{className:"pp-artifact-actions",children:[R&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:R,children:[l.jsx(fz,{className:"pp-ic"}),"导出配置文件"]}),q&&o&&l.jsx(Uge,{project:e,onChange:o,className:"pp-artifact-source"}),e.files.length>0&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:qt,children:[l.jsx(Jw,{className:"pp-ic"}),"导出源码"]})]})]})]})}),l.jsxs("div",{className:"pp-files-area",children:[l.jsxs("div",{className:"pp-sidebar",children:[l.jsxs("div",{className:"pp-sidebar-head",children:[l.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),q&&l.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{K(!0),B("")},children:l.jsx(hz,{className:"pp-ic"})})]}),l.jsxs("div",{className:"pp-tree",children:[I&&l.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:W,onChange:ue=>B(ue.target.value),onBlur:$t,onKeyDown:ue=>{ue.key==="Enter"&&$t(),ue.key==="Escape"&&(K(!1),B(""))}}),e.files.length===0&&!I?l.jsx("div",{className:"pp-empty",children:"暂无文件"}):vn(He,0,"")]})]}),l.jsxs("div",{className:"pp-main",children:[l.jsxs("div",{className:"pp-main-head",children:[l.jsx("span",{className:"pp-path",title:qe==null?void 0:qe.path,children:(qe==null?void 0:qe.path)??"未选择文件"}),l.jsx("div",{className:"pp-actions",children:q&&qe&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:wn,children:l.jsx(Lz,{className:"pp-ic"})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Fe,children:l.jsx(js,{className:"pp-ic"})})]})})]}),l.jsx("div",{className:"pp-content",children:qe==null?l.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):q?l.jsx("div",{className:"pp-codemirror",children:l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:l.jsx($ge,{value:qe.content,path:qe.path,onChange:un})})}):l.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:Kge(qe.content,qe.path)}})})]})]}),c&&l.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[l.jsx("div",{className:"pp-config-head",children:l.jsx("div",{className:"pp-config-title",children:"部署配置"})}),l.jsxs("div",{className:"pp-config-scroll",children:[O,!O&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"发布区域"}),Te(!1)]}),!O&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"消息渠道"}),l.jsx("div",{className:`pp-channel-card${g?" is-flipped":""}`,children:l.jsxs("div",{className:"pp-channel-card-inner",children:[l.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":g,"aria-hidden":g,tabIndex:g?-1:0,onClick:()=>void sn(),disabled:g||ie||te||!x,children:[l.jsx("span",{className:"pp-channel-logo",children:l.jsx("img",{src:Lge,alt:""})}),l.jsxs("span",{className:"pp-channel-card-copy",children:[l.jsx("strong",{children:"飞书"}),l.jsx("small",{children:te?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),l.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!g,children:[l.jsxs("div",{className:"pp-channel-card-head",children:[l.jsx("strong",{children:"飞书配置"}),l.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:g?0:-1,onClick:()=>void sn(),disabled:!g||ie||te||!x,children:te?"取消中…":"取消"})]}),l.jsx("div",{className:"pp-channel-fields",children:$u.map(ue=>l.jsxs("label",{children:[l.jsxs("span",{children:[ue.comment||ue.key,ue.required&&l.jsx("small",{children:"必填"})]}),l.jsx("input",{type:ue.key.includes("SECRET")?"password":"text",value:w[ue.key]??"",placeholder:ue.placeholder,tabIndex:g?0:-1,disabled:!g||ie||!b,autoComplete:"off",onChange:_e=>b==null?void 0:b(ue.key,_e.currentTarget.value)})]},ue.key))})]})]})})]}),l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"网络"}),O&&Te(!0),L&&l.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),l.jsxs("div",{className:"pp-network-layout",children:[l.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(ue=>l.jsxs("label",{className:"pp-network-option",children:[l.jsx("input",{type:"radio",name:"deployment-network-mode",value:ue,checked:Ut===ue,onChange:()=>be(ue),disabled:ie||L||!k}),l.jsx("span",{children:ue==="public"?"公网":ue==="private"?"VPC":"公网 + VPC"})]},ue))}),Ut!=="public"&&l.jsxs("div",{className:"pp-network-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"VPC ID"}),l.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:ie||L,onChange:ue=>Ve({vpcId:ue.target.value})})]}),l.jsxs("label",{children:[l.jsxs("span",{children:["子网 ID ",l.jsx("small",{children:"可选,多个用逗号分隔"})]}),l.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:ie||L,onChange:ue=>Ve({subnetIds:ue.target.value})})]}),l.jsxs("label",{className:"pp-network-check",children:[l.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:ie||L,onChange:ue=>Ve({enableSharedInternetAccess:ue.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),l.jsxs("section",{className:"pp-config-section pp-env-section",children:[l.jsxs("div",{className:"pp-env-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"pp-config-label",children:["环境变量",l.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[De," 项"]})]}),l.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),l.jsx("button",{type:"button",className:"pp-icon-btn",title:At?"隐藏值":"显示值",onClick:()=>ut(ue=>!ue),children:At?l.jsx(uz,{className:"pp-ic"}):l.jsx(ZL,{className:"pp-ic"})})]}),l.jsxs("button",{type:"button",className:"pp-env-add",onClick:_t,disabled:ie,children:[l.jsx(ir,{className:"pp-ic"}),"添加变量"]}),(Ye.length>0||xt.length>0)&&l.jsxs("div",{className:"pp-env-table",children:[Ye.length>0&&l.jsxs("div",{className:"pp-env-group",children:[l.jsxs("div",{className:"pp-env-group-head",children:[l.jsx("span",{children:"组件自动生成"}),l.jsxs("small",{children:[Ye.length," 项"]})]}),Ye.map(ue=>{const _e=ue.key.startsWith("ENABLE_");return l.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[l.jsx("input",{className:"pp-env-key-fixed",value:ue.key,readOnly:!0,disabled:ie,"aria-label":`${ue.key} 环境变量名`}),l.jsx("input",{type:_e||At?"text":"password",value:ue.value,placeholder:ue.required?"必填,尚未填写":"可选,尚未填写",readOnly:_e,disabled:ie||!_e&&!b,autoComplete:"off","aria-label":`${ue.key} 环境变量值`,onChange:ve=>b==null?void 0:b(ue.key,ve.currentTarget.value)}),l.jsx("span",{className:"pp-env-source",children:_e?"自动":"同步"})]},ue.key)})]}),xt.length>0&&l.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[l.jsx("span",{children:"自定义变量"}),l.jsxs("small",{children:[xt.length," 项"]})]}),xt.map(ue=>l.jsxs("div",{className:"pp-env-row",children:[l.jsx("input",{value:ue.key,placeholder:"名称",disabled:ie,autoComplete:"off",onChange:_e=>dt(ue.id,{key:_e.currentTarget.value})}),l.jsx("input",{type:At?"text":"password",value:ue.value,placeholder:"值",disabled:ie,autoComplete:"off",onChange:_e=>dt(ue.id,{value:_e.currentTarget.value})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:ie,onClick:()=>Lt(ue.id),children:l.jsx(Zr,{className:"pp-ic"})})]},ue.id))]})]}),(ie||me||Object.keys(Ie).length>0)&&l.jsxs("section",{className:"pp-config-section pp-progress-section",children:[l.jsx("div",{className:"pp-config-label",children:"部署进度"}),l.jsx("ol",{className:"pp-steps",children:D.map((ue,_e)=>{const ve=Ce?D.findIndex(ct=>ct.phase===Ce):-1,ye=!!we&&(ve===-1?_e===0:_e===ve);let nt;me?nt="done":ye?nt="failed":ve===-1?nt=ie?"active":"pending":_eue.phase===Ce))==null?void 0:Mn.label)??Ce}阶段):`:""}${we}`,onRetry:an,retryLabel:L?"重试更新":"重试部署"}),me&&l.jsxs("section",{className:"pp-deploy-result",children:[l.jsx("div",{className:"pp-deploy-result-header",children:L?"更新成功":"部署成功"}),l.jsxs("div",{className:"pp-deploy-result-body",children:[me.region&&l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"区域"}),l.jsx("code",{children:me.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"Agent 名称"}),l.jsx("code",{children:me.agentName})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"API 端点"}),l.jsx("code",{className:"pp-deploy-result-url",children:me.url})]})]}),l.jsxs("div",{className:"pp-deploy-result-actions",children:[l.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Bt,disabled:Ge,children:[Ge?l.jsx(Kt,{className:"pp-ic spin"}):l.jsx(iM,{className:"pp-ic"}),Ge?"连接中…":"立即对话"]}),me.consoleUrl&&l.jsxs("a",{href:me.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[l.jsx(ev,{className:"pp-ic"}),"控制台"]})]})]})]}),l.jsx("div",{className:"pp-config-actions",children:l.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:an,disabled:ie||te||F||!!n,title:n,children:ie?`${f}中…`:we?`重试${f}`:f})})]})]}),J&&r&&Us.createPortal(l.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ue=>{ue.target===ue.currentTarget&&fe(!1)},children:l.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[l.jsxs("header",{children:[l.jsxs("div",{children:[l.jsx("strong",{children:"执行流程"}),l.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),l.jsx("button",{type:"button",onClick:()=>fe(!1),"aria-label":"关闭执行流程预览",children:l.jsx(Zr,{"aria-hidden":!0})})]}),l.jsx("div",{className:"pp-flow-dialog-canvas",children:l.jsx(yg,{draft:r,direction:"horizontal",selectedPath:[],onSelect:Ia,onAdd:Ia,onInsert:Ia,onDelete:Ia,readOnly:!0,interactivePreview:!0})})]})}),document.body),l.jsx(Hge,{open:ee,isUpdate:L,onCancel:zt,onConfirm:()=>void Ht()})]})}const AC="dogfooding",Lb="dogfooding",Mb="dogfooding_b";let Zge=0;const jb=()=>++Zge;function CC(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function Jge(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function IC(e){const t=[],n=Jge(e);t.push(n);const r=n.indexOf("{"),s=n.lastIndexOf("}");r>=0&&s>r&&t.push(n.slice(r,s+1));for(const i of t)try{const a=JSON.parse(i);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await pv(D_(a))}catch{}return null}function e0e({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:s}){const[i,a]=E.useState([{id:jb(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,c]=E.useState(""),[u,d]=E.useState(!1),[f,h]=E.useState(null),[p,m]=E.useState(null),[g,x]=E.useState(!1),[y,w]=E.useState(null),[b,_]=E.useState(null),[k,N]=E.useState(!1),[A,S]=E.useState(!1),[C,R]=E.useState({}),O=E.useRef(null),F=E.useRef(null),q=E.useRef(null),L=E.useRef(null),D=E.useRef(null);E.useEffect(()=>{const Q=L.current;Q&&Q.scrollTo({top:Q.scrollHeight,behavior:"smooth"})},[i,u]),E.useEffect(()=>{const Q=D.current;Q&&(Q.style.height="auto",Q.style.height=Math.min(Q.scrollHeight,160)+"px")},[o]);const T=Q=>a(ee=>[...ee,{id:jb(),role:"assistant",text:Q}]);async function M(){if(O.current)return O.current;const Q=await Vm(AC,e);return O.current=Q,Q}async function j(Q,ee){if(ee.current)return ee.current;const ce=await Vm(Q,e);return ee.current=ce,ce}async function U(Q,ee){if(!C[Q])try{const ce=await fv(ee);R(J=>({...J,[Q]:ce.model||ee}))}catch{R(ce=>({...ce,[Q]:ee}))}}async function I(Q,ee,ce){const J=await j(Q,ee);let fe=si();for await(const ge of bf({appName:Q,userId:e,sessionId:J,text:ce}))fe=Dc(fe,ge);const te=CC(fe).trim();return{project:await IC(te),finalText:te}}const K=async(Q,ee,ce)=>t0(Q.name,Q.files,{region:"cn-beijing",projectName:"default"},{...ce,onStage:ee}),W=async()=>{const Q=o.trim();if(!(!Q||u)){if(a(ee=>[...ee,{id:jb(),role:"user",text:Q}]),c(""),h(null),d(!0),g){w(null),_(null),N(!0),S(!0),U("a",Lb),U("b",Mb);const ee=I(Lb,F,Q).then(({project:J})=>(w(J),J)).catch(J=>{const fe=J instanceof Error?J.message:String(J);return h(fe),null}).finally(()=>N(!1)),ce=I(Mb,q,Q).then(({project:J})=>(_(J),J)).catch(J=>{const fe=J instanceof Error?J.message:String(J);return h(fe),null}).finally(()=>S(!1));try{const[J,fe]=await Promise.all([ee,ce]),te=[J?`方案 A:${J.name}`:null,fe?`方案 B:${fe.name}`:null].filter(Boolean);te.length?T(`已生成两个方案(${te.join(",")}),请在右侧对比后采用其一。`):T("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const ee=await M();let ce=si();for await(const te of bf({appName:AC,userId:e,sessionId:ee,text:Q}))ce=Dc(ce,te);const J=CC(ce).trim(),fe=await IC(J);fe?(m(fe),T(`已生成项目:${fe.name}(${fe.files.length} 个文件),可在右侧预览和编辑。`)):T(J||"(助手没有返回内容,请再描述一下你的需求。)")}catch(ee){const ce=ee instanceof Error?ee.message:String(ee);h(ce),T(`抱歉,调用智能构建助手失败:${ce}`)}finally{d(!1)}}},B=Q=>{const ee=Q==="a"?y:b;if(!ee)return;m(ee),x(!1),w(null),_(null),N(!1),S(!1);const ce=Q==="a"?"A":"B",J=Q==="a"?C.a:C.b;T(`已采用方案 ${ce}(${J??(Q==="a"?Lb:Mb)}),可继续编辑。`)},ie=Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.nativeEvent.isComposing&&(Q.preventDefault(),W())};return l.jsx("div",{className:"ic-root",children:l.jsxs("div",{className:"ic-body",children:[l.jsxs("div",{className:"ic-chat",children:[l.jsxs("div",{className:"ic-transcript",ref:L,children:[l.jsx(ni,{initial:!1,children:i.map(Q=>l.jsxs(Wt.div,{className:`ic-turn ic-turn--${Q.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[Q.role==="assistant"&&l.jsx("div",{className:"ic-avatar",children:l.jsx(tl,{className:"ic-avatar-icon"})}),l.jsx("div",{className:"ic-bubble",children:Q.role==="assistant"?l.jsx(sh,{text:Q.text}):Q.text})]},Q.id))}),u&&l.jsxs(Wt.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[l.jsx("div",{className:"ic-avatar",children:l.jsx(tl,{className:"ic-avatar-icon"})}),l.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"})]})]})]}),f&&l.jsxs("div",{className:"ic-error",children:[l.jsx(qg,{className:"ic-error-icon"}),f]}),l.jsxs("div",{className:"ic-composer",children:[l.jsxs("div",{className:"ic-composer-box",children:[l.jsx("textarea",{ref:D,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:Q=>c(Q.target.value),onKeyDown:ie,disabled:u}),l.jsx("button",{className:"ic-send",onClick:()=>void W(),disabled:!o.trim()||u,title:"发送 (Enter)",children:l.jsx(Pz,{className:"ic-send-icon"})})]}),l.jsxs("div",{className:"ic-composer-foot",children:[l.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[l.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:g,disabled:u,onChange:Q=>x(Q.target.checked)}),l.jsx("span",{className:"ic-ab-track",children:l.jsx("span",{className:"ic-ab-thumb"})}),l.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),l.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),l.jsx("aside",{className:"ic-preview",children:g?l.jsxs("div",{className:"ic-compare",children:[l.jsx(RC,{side:"a",project:y,loading:k,model:C.a,onAdopt:()=>B("a")}),l.jsx("div",{className:"ic-compare-divider"}),l.jsx(RC,{side:"b",project:b,loading:A,model:C.b,onAdopt:()=>B("b")})]}):p?l.jsx(U0,{project:p,onChange:m,onDeploy:K,onAgentAdded:r,onDeploymentTaskChange:s}):l.jsxs("div",{className:"ic-preview-empty",children:[l.jsxs("div",{className:"ic-preview-empty-icon",children:[l.jsx(yz,{className:"ic-preview-empty-glyph"}),l.jsx(nl,{className:"ic-preview-empty-spark"})]}),l.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),l.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function RC({side:e,project:t,loading:n,model:r,onAdopt:s}){const i=e==="a"?"方案 A":"方案 B";return l.jsxs("div",{className:"ic-pane",children:[l.jsxs("div",{className:"ic-pane-head",children:[l.jsxs("div",{className:"ic-pane-title",children:[l.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:i}),r&&l.jsx("span",{className:"ic-pane-model",children:r})]}),l.jsxs("button",{className:"ic-adopt",onClick:s,disabled:!t||n,title:`采用${i}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),l.jsx("div",{className:"ic-pane-body",children:n?l.jsxs("div",{className:"ic-pane-loading",children:[l.jsx(Kt,{className:"ic-pane-spinner"}),l.jsx("span",{children:"正在生成…"})]}):t?l.jsx(U0,{project:t}):l.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const t0e=/^[A-Za-z_][A-Za-z0-9_]*$/;function Nc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":t0e.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function _5(e){const t=new Set,n=new Set,r=s=>{Nc(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(r)};return r(e),n}function n0e({className:e,...t}){return l.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:[l.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"}),l.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 Zu={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:n0e},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:bz},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:Fz},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:nv},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:Xg}},r0e=[Zu.llm,Zu.sequential,Zu.parallel,Zu.loop,Zu.a2a],k5=e=>e==="sequential"||e==="parallel"||e==="loop",$0=e=>e==="a2a";function Hs(e){return e.trimEnd().replace(/[。.]+$/,"")}function vg(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(r=>r==null?void 0:r.toLocaleLowerCase().includes(n)):!0}function _o(e,t){return e[t]|e[t+1]<<8}function Ll(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function s0e(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 N5(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(Ll(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const s=_o(e,r+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let i=Ll(e,r+16);const a=new TextDecoder("utf-8"),o=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const w=_o(e,x+26),b=_o(e,x+28),_=x+30+w+b,k=e.subarray(_,_+f);let N;if(d===0)N=k;else if(d===8)N=await s0e(k);else{i+=46+p+m+g;continue}o.push({name:y,text:a.decode(N)}),i+=46+p+m+g}return o}const i0e="/skillhub/v1/skills";async function a0e(e,t="public"){const n=e.trim(),r=`${i0e}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(r,{headers:{accept:"application/json"},signal:ci(void 0,lu)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function o0e({selected:e,onChange:t}){const[n,r]=E.useState(""),[s,i]=E.useState([]),[a,o]=E.useState(!1),[c,u]=E.useState(null),[d,f]=E.useState(!1),h=g=>e.some(x=>x.source==="skillhub"&&x.slug===g),p=g=>{g.slug&&(h(g.slug)?t(e.filter(x=>!(x.source==="skillhub"&&x.slug===g.slug))):t([...e,{source:"skillhub",slug:g.slug,name:g.name,folder:g.slug.split("/").pop()||g.name,namespace:g.namespace||"public",description:g.description}]))},m=async g=>{o(!0),u(null),f(!0);try{const x=await a0e(g);i(x)}catch(x){u(x instanceof Error?x.message:"搜索失败,请稍后重试。"),i([])}finally{o(!1)}};return E.useEffect(()=>{const g=n.trim();if(!g){i([]),f(!1),u(null);return}const x=setTimeout(()=>m(g),300);return()=>clearTimeout(x)},[n]),l.jsxs("div",{className:"cw-skillhub",children:[l.jsxs("div",{className:"cw-skill-searchrow",children:[l.jsxs("div",{className:"cw-skill-searchbox",children:[l.jsx(gf,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),l.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),n.trim()&&m(n))}})]}),l.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?l.jsx(Kt,{className:"cw-i cw-spin"}):l.jsx(gf,{className:"cw-i"}),"搜索"]})]}),c&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:c})]}),a&&s.length===0?l.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):s.length>0?l.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const x=h(g.slug||"");return l.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>p(g),"aria-pressed":x,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:g.name}),g.description&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(g.description)}),g.sourceRepo&&l.jsx("span",{className:"cw-skill-result-repo",children:g.sourceRepo})]})]},g.id||g.slug)})}):d&&!c?l.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&l.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const gx=/(^|\/)skill\.md$/i;function l0e(e){const t=(e??"").replace(/\r\n?/g,` +`+Nge(E5(e))}function Age(e){const t=kge(e);return D_(t)}const Cge=[{kind:"custom",icon:zz,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:Az,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:_z,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:Vz,title:"工作流",desc:"敬请期待",disabled:!0}];function Ige({onSelect:e,onImport:t}){const n=E.useRef(null),[r,s]=E.useState(""),i=Cge.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const c=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!c)try{const d=await c.text();t(Age(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return l.jsx(_6,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:i,footer:l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[l.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[l.jsx($z,{}),"导入 YAML 配置"]}),r&&l.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),l.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Rge="modulepreload",Oge=function(e){return"/"+e},vC={},Nc=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Oge(c),c in vC)return;vC[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":Rge,u||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),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 i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function x5(e){const t=new Map,n={};for(const r of e){for(const s of r.env){const i=t.get(s.key);(!i||s.required&&!i.required)&&t.set(s.key,s)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Lge(e,t){return x5([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function w5(e,t){const n=new Map;for(const r of e){const s=t[r.key]??"";s.trim()&&n.set(r.key,s)}return[...n].map(([r,s])=>({key:r,value:s}))}function _C(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const Mge="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",jge=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function Dge(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function kn(e,t){e.push(t&255,t>>>8&255)}function ss(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const kC=2048,Ob=20,NC=0;function Pge(e){const t=new TextEncoder,n=[],r=[];let s=0;for(const p of e){const m=t.encode(p.path),g=t.encode(p.content),x=Dge(g),y=g.length,w=[];ss(w,67324752),kn(w,Ob),kn(w,kC),kn(w,NC),kn(w,0),kn(w,0),ss(w,x),ss(w,y),ss(w,y),kn(w,m.length),kn(w,0);const b=Uint8Array.from(w);n.push(b,m,g),r.push({nameBytes:m,dataBytes:g,crc:x,size:y,offset:s}),s+=b.length+m.length+g.length}const i=s,a=[];let o=0;for(const p of r){const m=[];ss(m,33639248),kn(m,Ob),kn(m,Ob),kn(m,kC),kn(m,NC),kn(m,0),kn(m,0),ss(m,p.crc),ss(m,p.size),ss(m,p.size),kn(m,p.nameBytes.length),kn(m,0),kn(m,0),kn(m,0),kn(m,0),ss(m,0),ss(m,p.offset);const g=Uint8Array.from(m);a.push(g,p.nameBytes),o+=g.length+p.nameBytes.length}const c=[];ss(c,101010256),kn(c,0),kn(c,0),kn(c,r.length),kn(c,r.length),ss(c,o),ss(c,i),kn(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 Bge=E.lazy(()=>Nc(()=>import("./CodeEditor-B-6sJbzV.js"),[]));function Fge(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function Uge(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function v5({project:e,open:t,onClose:n,onChange:r}){var m;const[s,i]=E.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=E.useState(new Set),c=E.useRef(null),u=E.useMemo(()=>Fge(e.files),[e.files]),d=e.files.find(g=>g.path===s)??null;if(E.useEffect(()=>{var y;if(!t)return;const g=document.body.style.overflow;document.body.style.overflow="hidden",(y=c.current)==null||y.focus();const x=w=>{w.key==="Escape"&&n()};return window.addEventListener("keydown",x),()=>{document.body.style.overflow=g,window.removeEventListener("keydown",x)}},[n,t]),E.useEffect(()=>{d||e.files.length===0||i(e.files[0].path)},[e.files,d]),!t)return null;function f(g){o(x=>{const y=new Set(x);return y.has(g)?y.delete(g):y.add(g),y})}function h(g,x,y){return Uge(g).map(w=>{const b=y?`${y}/${w.name}`:w.name;if(!(w.children.size>0&&w.path===void 0)&&w.path)return l.jsxs("button",{type:"button",className:`code-browser-file${s===w.path?" is-active":""}`,style:{paddingLeft:`${12+x*16}px`},onClick:()=>i(w.path??null),title:w.path,children:[l.jsx(PS,{"aria-hidden":"true"}),l.jsx("span",{children:w.name})]},b);const k=a.has(b);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+x*16}px`},onClick:()=>f(b),"aria-expanded":!k,children:[l.jsx(Ms,{className:k?"":"is-open","aria-hidden":"true"}),l.jsx(tM,{"aria-hidden":"true"}),l.jsx("span",{children:w.name})]}),!k&&h(w,x+1,b)]},b)})}function p(g){d&&r({...e,files:e.files.map(x=>x.path===d.path?{...x,content:g}:x)})}return Us.createPortal(l.jsx("div",{className:"code-browser-backdrop",onMouseDown:g=>{g.target===g.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[l.jsxs("header",{className:"code-browser-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:l.jsx(Qw,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"code-browser-title",children:"项目代码"}),l.jsx("p",{children:e.name||"Agent 项目"})]})]}),l.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:l.jsx(Zr,{"aria-hidden":"true"})})]}),l.jsxs("div",{className:"code-browser-workspace",children:[l.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[l.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",l.jsx("span",{children:e.files.length})]}),l.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):l.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),l.jsxs("main",{className:"code-browser-main",children:[l.jsxs("div",{className:"code-browser-path",children:[l.jsx(PS,{"aria-hidden":"true"}),l.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),l.jsx("div",{className:"code-browser-editor",children:d?l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:l.jsx(Bge,{value:d.content,path:d.path,onChange:p})}):l.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function $ge({project:e,onChange:t,className:n=""}){const[r,s]=E.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[l.jsx(Qw,{"aria-hidden":"true"}),l.jsx("span",{children:"查看源码"})]}),l.jsx(v5,{project:e,open:r,onClose:()=>s(!1),onChange:t})]})}function wg({message:e,className:t="",onRetry:n,retryLabel:r="重试部署"}){const[s,i]=E.useState(!1),[a,o]=E.useState(!1),[c,u]=E.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1500)}catch{o(!1)}},f=async()=>{if(!(!n||c)){u(!0);try{await n()}finally{u(!1)}}};return l.jsxs("div",{className:`deploy-error-message${s?" is-expanded":""}${t?` ${t}`:""}`,children:[l.jsx("p",{className:"deploy-error-message-text",children:e}),l.jsxs("div",{className:"deploy-error-message-actions",children:[n&&l.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:c,onClick:()=>void f(),children:[c?l.jsx(Kt,{className:"spin"}):l.jsx(Dz,{}),c?"重试中…":r]}),l.jsx("button",{type:"button",title:s?"收起错误信息":"展开完整错误信息","aria-label":s?"收起错误信息":"展开完整错误信息",onClick:()=>i(h=>!h),children:s?l.jsx(Iz,{}):l.jsx(gc,{})}),l.jsx("button",{type:"button",title:a?"已复制":"复制完整错误信息","aria-label":a?"已复制":"复制完整错误信息",onClick:()=>void d(),children:a?l.jsx(pi,{}):l.jsx(Zw,{})})]})]})}Qr.registerLanguage("python",Oj);Qr.registerLanguage("typescript",Vj);Qr.registerLanguage("javascript",Sj);Qr.registerLanguage("json",Tj);Qr.registerLanguage("yaml",Kj);Qr.registerLanguage("markdown",Rj);Qr.registerLanguage("bash",xj);Qr.registerLanguage("ini",wj);Qr.registerLanguage("dockerfile",SZ);Qr.registerLanguage("makefile",Ij);const Hge=E.lazy(()=>Nc(()=>import("./CodeEditor-B-6sJbzV.js"),[])),Ia=()=>{};function zge({open:e,isUpdate:t,onCancel:n,onConfirm:r}){const s=E.useRef(null);return E.useEffect(()=>{var o;if(!e)return;const i=document.body.style.overflow;document.body.style.overflow="hidden",(o=s.current)==null||o.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=i,window.removeEventListener("keydown",a)}},[n,e]),e?Us.createPortal(l.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:i=>{i.target===i.currentTarget&&n()},children:l.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:[l.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:l.jsx(Uz,{})}),l.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),l.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:l.jsx(Zr,{"aria-hidden":"true"})})]}),l.jsx("div",{className:"pp-confirm-body",children:l.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),l.jsxs("footer",{className:"pp-confirm-actions",children:[l.jsx("button",{ref:s,type:"button",onClick:n,children:"取消"}),l.jsx("button",{type:"button",className:"is-primary",onClick:r,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}const Vge={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"},SC={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function TC(e){return e.replace(/&/g,"&").replace(//g,">")}function Kge(e){const n=(e.split("/").pop()??e).toLowerCase();if(SC[n])return SC[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const s=n.slice(r+1);return Vge[s]??null}function Yge(e,t){try{const n=Kge(t);return n&&Qr.getLanguage(n)?Qr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?Qr.highlightAuto(e).value:TC(e)}catch{return TC(e)}}const Gge=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],Wge=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function qge(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function Xge(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function Qge(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function Zge({left:e,right:t}){const[n,r]=E.useState(null);return E.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),i=document.getElementById("veadk-page-header-actions");s&&i&&r({left:s,right:i})},[]),n?l.jsxs(l.Fragment,{children:[Us.createPortal(e,n.left),Us.createPortal(t,n.right)]}):l.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function U0({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:r,agentName:s,agentCount:i,releaseConfiguration:a,onChange:o,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentRuntimeId:h,onDeploymentStarted:p,onDeploymentTaskChange:m,feishuEnabled:g=!1,onFeishuEnabledChange:x,deploymentEnv:y=[],deploymentEnvValues:w={},onDeploymentEnvChange:b,network:_,onNetworkChange:k,deployRegion:N="cn-beijing",onDeployRegionChange:A,onBack:S,backLabel:C="返回配置",onExportYaml:R,deploymentPrimaryPane:O,deployDisabled:F=!1}){var Xt,Ln,Mn;const q=typeof o=="function",L=f.includes("更新"),D=O?Wge:Gge,[T,M]=E.useState(((Ln=(Xt=e==null?void 0:e.files)==null?void 0:Xt[0])==null?void 0:Ln.path)??null),[j,U]=E.useState(new Set),[I,K]=E.useState(!1),[W,B]=E.useState(""),[ie,Q]=E.useState(!1),[ee,ce]=E.useState(!1),[J,fe]=E.useState(!1),[te,ge]=E.useState(!1),[we,Z]=E.useState(null),[me,Ne]=E.useState(null),[Ie,We]=E.useState({}),[Ce,et]=E.useState(null),[Ge,Xe]=E.useState(!1),[xt,gt]=E.useState([]),[At,ut]=E.useState(!1),[X,ne]=E.useState(!1),he=E.useRef(!0),Te=ue=>l.jsxs("div",{className:"pp-network-region",onKeyDown:_e=>{_e.key==="Escape"&&ne(!1)},children:[ue&&l.jsx("span",{children:"发布区域"}),l.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":X,disabled:ie||L||!A,onClick:()=>ne(_e=>!_e),children:[l.jsx("span",{children:N==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),l.jsx(Xw,{className:`pp-region-chevron${X?" is-open":""}`})]}),X&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>ne(!1)}),l.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(_e=>{const ve=_e.value===N;return l.jsxs("button",{type:"button",role:"option","aria-selected":ve,className:`pp-region-option${ve?" is-selected":""}`,onClick:()=>{A==null||A(_e.value),ne(!1)},children:[l.jsx("span",{children:_e.label}),ve&&l.jsx(pi,{"aria-hidden":"true"})]},_e.value)})})]})]});E.useEffect(()=>(he.current=!0,()=>{he.current=!1}),[]),E.useEffect(()=>{if(!J)return;const ue=document.body.style.overflow;document.body.style.overflow="hidden";const _e=ve=>{ve.key==="Escape"&&fe(!1)};return window.addEventListener("keydown",_e),()=>{document.body.style.overflow=ue,window.removeEventListener("keydown",_e)}},[J]);const He=E.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:qge(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return l.jsx("div",{className:"pp-error",children:"项目数据无效"});const qe=e.files.find(ue=>ue.path===T)??null,Ut=(_==null?void 0:_.mode)??"public",Ye=Lge(g?[...y,...Hu]:y,w),De=Ye.length+xt.length;function Be(ue){U(_e=>{const ve=new Set(_e);return ve.has(ue)?ve.delete(ue):ve.add(ue),ve})}function Ct(ue,_e){o&&(o({...e,files:ue}),_e!==void 0&&M(_e))}function un(ue){qe&&Ct(e.files.map(_e=>_e.path===qe.path?{..._e,content:ue}:_e))}function $t(){const ue=W.trim();if(K(!1),B(""),!!ue){if(e.files.some(_e=>_e.path===ue)){M(ue);return}Ct([...e.files,{path:ue,content:""}],ue)}}function wn(){if(!qe)return;const ue=window.prompt("重命名文件",qe.path),_e=ue==null?void 0:ue.trim();!_e||_e===qe.path||e.files.some(ve=>ve.path===_e)||Ct(e.files.map(ve=>ve.path===qe.path?{...ve,path:_e}:ve),_e)}function Fe(){var _e;if(!qe)return;const ue=e.files.filter(ve=>ve.path!==qe.path);Ct(ue,((_e=ue[0])==null?void 0:_e.path)??null)}function dt(ue,_e){gt(ve=>ve.map(ye=>ye.id===ue?{...ye,..._e}:ye))}function Lt(ue){gt(_e=>_e.filter(ve=>ve.id!==ue))}function _t(){gt(ue=>[...ue,Qge()])}function be(ue){k&&k(ue==="public"?void 0:{..._??{mode:ue},mode:ue})}function Ve(ue){k==null||k({..._??{mode:"private"},...ue})}function st(){const ue=new Map(xt.map(ve=>({key:ve.key.trim(),value:ve.value})).filter(ve=>ve.key.length>0).map(ve=>[ve.key,ve.value])),_e=g?[...y,...Hu]:y;for(const ve of w5(_e,w))ue.set(ve.key,ve.value);return[...ue].map(([ve,ye])=>({key:ve,value:ye}))}async function sn(){if(!(!x||ie||te)){Z(null),ge(!0);try{await x(!g)}catch(ue){he.current&&Z(`更新飞书配置失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{he.current&&ge(!1)}}}async function an(){var _e;if(!c||ie||F)return;if(Ut!=="public"&&!((_e=_==null?void 0:_.vpcId)!=null&&_e.trim())){Z("使用 VPC 网络时,请填写 VPC ID。");return}const ue=_C(y,w);if(ue){const ve=y.find(ye=>ye.key===ue.key);Z(`请返回配置页填写 ${(ve==null?void 0:ve.comment)||(ve==null?void 0:ve.key)}(${ve==null?void 0:ve.key})。`);return}if(g){const ve=_C(Hu,w);if(ve){const ye=Hu.find(nt=>nt.key===ve.key);Z(`启用飞书后,请填写${(ye==null?void 0:ye.comment)||(ye==null?void 0:ye.key)}。`);return}}ce(!0)}async function Ht(){if(!c||ie)return;ce(!1);const ue=st();he.current&&(Z(null),Ne(null),We({}),et(null),Q(!0));const _e=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let ve=(s==null?void 0:s.trim())||e.name||"生成中…";const ye=Date.now(),nt={id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"running",phase:"prepare",label:"准备部署",agentDraft:r};m==null||m(nt),p==null||p(nt);try{const Qe=await c(e,ct=>{var ot;ct.runtimeName&&(ve=ct.runtimeName),he.current&&(We(oe=>({...oe,[ct.phase]:ct})),et(ct.phase)),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"running",phase:ct.phase,label:((ot=D.find(oe=>oe.phase===ct.phase))==null?void 0:ot.label)??ct.phase,message:ct.message,pct:ct.pct})},g?{taskId:_e,im:{feishu:{enabled:!0}},envs:ue}:{taskId:_e,envs:ue});he.current&&(Ne(Qe),et(null)),await(d==null?void 0:d(Qe)),m==null||m({id:_e,runtimeName:Qe.agentName||ve,runtimeId:Qe.runtimeId||h,region:Qe.region||N,startedAt:ye,status:"success",phase:"complete",label:"部署完成"})}catch(Qe){const ct=Qe instanceof Error?Qe.message:String(Qe);if(Qe instanceof DOMException&&Qe.name==="AbortError"){he.current&&(Z(null),et(null)),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}he.current&&Z(ct),m==null||m({id:_e,runtimeName:ve,runtimeId:h,region:N,startedAt:ye,status:"error",label:"部署失败",message:ct,retry:an})}finally{he.current&&Q(!1)}}function zt(){ce(!1)}async function Bt(){if(!(!me||Ge)){Xe(!0),Z(null);try{const{addConnection:ue,addRuntimeConnection:_e,remoteAppId:ve,loadConnections:ye}=await Nc(async()=>{const{addConnection:ct,addRuntimeConnection:ot,remoteAppId:oe,loadConnections:Ze}=await Promise.resolve().then(()=>XS);return{addConnection:ct,addRuntimeConnection:ot,remoteAppId:oe,loadConnections:Ze}},void 0),{probeRuntimeApps:nt}=await Nc(async()=>{const{probeRuntimeApps:ct}=await Promise.resolve().then(()=>pV);return{probeRuntimeApps:ct}},void 0);let Qe;if(me.runtimeId){const ct=me.region??"cn-beijing",ot=await nt(me.runtimeId,ct)??[];Qe=_e(me.runtimeId,me.agentName,ct,ot,ot.length>0?{[ot[0]]:me.agentName}:void 0,me.version)}else Qe=await ue(me.agentName,me.url,me.apikey,"");if(Qe.apps.length===0)Z("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const ct={[Qe.apps[0]]:me.agentName},ot={...Qe,appLabels:{...Qe.appLabels??{},...ct}},Ze=ye().map(it=>it.id===Qe.id?ot:it);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(Ze));const{registerConnections:It}=await Nc(async()=>{const{registerConnections:it}=await Promise.resolve().then(()=>XS);return{registerConnections:it}},void 0);if(It(Ze),u){const it=ve(Qe.id,Qe.apps[0]);u(it,me.agentName)}else alert(`🎉 Agent "${me.agentName}" 已添加到左上角下拉列表!`)}}catch(ue){Z(`添加 Agent 失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{Xe(!1)}}}function qt(){const ue=Pge(e.files),_e=URL.createObjectURL(ue),ve=document.createElement("a");ve.href=_e,ve.download=`${e.name||"project"}.zip`,document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(_e)}function vn(ue,_e,ve){return Xge(ue).map(ye=>{const nt=ve?`${ve}/${ye.name}`:ye.name,Qe=ye.path!==void 0,ct={paddingLeft:8+_e*14};if(Qe){const oe=ye.path===T;return l.jsxs("button",{type:"button",className:`pp-row pp-file${oe?" pp-active":""}`,style:ct,onClick:()=>M(ye.path),title:ye.path,children:[l.jsx(mz,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:ye.name})]},nt)}const ot=j.has(nt);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"pp-row pp-folder",style:ct,onClick:()=>Be(nt),children:[l.jsx(Ms,{className:`pp-ic pp-chevron${ot?"":" pp-open"}`}),l.jsx(tM,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:ye.name})]}),!ot&&vn(ye,_e+1,nt)]},nt)})}return l.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${O?" has-primary-pane":""}`,children:[c&&!t&&l.jsx(Zge,{left:l.jsxs("div",{className:"pp-toolbar-left",children:[S&&l.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:S,children:[l.jsx(qw,{className:"pp-ic"}),C]}),l.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",i&&i>1?` 等 ${i} 个智能体`:""]})]}),right:null}),l.jsxs("div",{className:"pp-body",children:[c&&!O&&l.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:l.jsxs("div",{className:"pp-release-preview",children:[l.jsxs("div",{className:"pp-flow-thumbnail",children:[r&&l.jsx(yg,{draft:r,direction:"horizontal",selectedPath:[],onSelect:Ia,onAdd:Ia,onInsert:Ia,onDelete:Ia,readOnly:!0,interactivePreview:!0}),l.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>fe(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:l.jsx(gc,{"aria-hidden":!0})})]}),l.jsxs("div",{className:"pp-release-info",children:[l.jsxs("div",{className:"pp-release-info-main",children:[l.jsx("h2",{children:s||e.name||"未命名 Agent"}),(r==null?void 0:r.description)&&l.jsx("p",{className:"pp-release-description",title:r.description,children:r.description}),l.jsxs("dl",{className:"pp-release-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Agent 数量"}),l.jsx("dd",{children:i??1})]}),a&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:a.modelName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"描述"}),l.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"系统提示词"}),l.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"优化选项"}),l.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),l.jsxs("div",{className:"pp-artifact-actions",children:[R&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:R,children:[l.jsx(fz,{className:"pp-ic"}),"导出配置文件"]}),q&&o&&l.jsx($ge,{project:e,onChange:o,className:"pp-artifact-source"}),e.files.length>0&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:qt,children:[l.jsx(Jw,{className:"pp-ic"}),"导出源码"]})]})]})]})}),l.jsxs("div",{className:"pp-files-area",children:[l.jsxs("div",{className:"pp-sidebar",children:[l.jsxs("div",{className:"pp-sidebar-head",children:[l.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),q&&l.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{K(!0),B("")},children:l.jsx(hz,{className:"pp-ic"})})]}),l.jsxs("div",{className:"pp-tree",children:[I&&l.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:W,onChange:ue=>B(ue.target.value),onBlur:$t,onKeyDown:ue=>{ue.key==="Enter"&&$t(),ue.key==="Escape"&&(K(!1),B(""))}}),e.files.length===0&&!I?l.jsx("div",{className:"pp-empty",children:"暂无文件"}):vn(He,0,"")]})]}),l.jsxs("div",{className:"pp-main",children:[l.jsxs("div",{className:"pp-main-head",children:[l.jsx("span",{className:"pp-path",title:qe==null?void 0:qe.path,children:(qe==null?void 0:qe.path)??"未选择文件"}),l.jsx("div",{className:"pp-actions",children:q&&qe&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:wn,children:l.jsx(Lz,{className:"pp-ic"})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Fe,children:l.jsx(js,{className:"pp-ic"})})]})})]}),l.jsx("div",{className:"pp-content",children:qe==null?l.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):q?l.jsx("div",{className:"pp-codemirror",children:l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:l.jsx(Hge,{value:qe.content,path:qe.path,onChange:un})})}):l.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:Yge(qe.content,qe.path)}})})]})]}),c&&l.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[l.jsx("div",{className:"pp-config-head",children:l.jsx("div",{className:"pp-config-title",children:"部署配置"})}),l.jsxs("div",{className:"pp-config-scroll",children:[O,!O&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"发布区域"}),Te(!1)]}),!O&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"消息渠道"}),l.jsx("div",{className:`pp-channel-card${g?" is-flipped":""}`,children:l.jsxs("div",{className:"pp-channel-card-inner",children:[l.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":g,"aria-hidden":g,tabIndex:g?-1:0,onClick:()=>void sn(),disabled:g||ie||te||!x,children:[l.jsx("span",{className:"pp-channel-logo",children:l.jsx("img",{src:Mge,alt:""})}),l.jsxs("span",{className:"pp-channel-card-copy",children:[l.jsx("strong",{children:"飞书"}),l.jsx("small",{children:te?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),l.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!g,children:[l.jsxs("div",{className:"pp-channel-card-head",children:[l.jsx("strong",{children:"飞书配置"}),l.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:g?0:-1,onClick:()=>void sn(),disabled:!g||ie||te||!x,children:te?"取消中…":"取消"})]}),l.jsx("div",{className:"pp-channel-fields",children:Hu.map(ue=>l.jsxs("label",{children:[l.jsxs("span",{children:[ue.comment||ue.key,ue.required&&l.jsx("small",{children:"必填"})]}),l.jsx("input",{type:ue.key.includes("SECRET")?"password":"text",value:w[ue.key]??"",placeholder:ue.placeholder,tabIndex:g?0:-1,disabled:!g||ie||!b,autoComplete:"off",onChange:_e=>b==null?void 0:b(ue.key,_e.currentTarget.value)})]},ue.key))})]})]})})]}),l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"网络"}),O&&Te(!0),L&&l.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),l.jsxs("div",{className:"pp-network-layout",children:[l.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(ue=>l.jsxs("label",{className:"pp-network-option",children:[l.jsx("input",{type:"radio",name:"deployment-network-mode",value:ue,checked:Ut===ue,onChange:()=>be(ue),disabled:ie||L||!k}),l.jsx("span",{children:ue==="public"?"公网":ue==="private"?"VPC":"公网 + VPC"})]},ue))}),Ut!=="public"&&l.jsxs("div",{className:"pp-network-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"VPC ID"}),l.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:ie||L,onChange:ue=>Ve({vpcId:ue.target.value})})]}),l.jsxs("label",{children:[l.jsxs("span",{children:["子网 ID ",l.jsx("small",{children:"可选,多个用逗号分隔"})]}),l.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:ie||L,onChange:ue=>Ve({subnetIds:ue.target.value})})]}),l.jsxs("label",{className:"pp-network-check",children:[l.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:ie||L,onChange:ue=>Ve({enableSharedInternetAccess:ue.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),l.jsxs("section",{className:"pp-config-section pp-env-section",children:[l.jsxs("div",{className:"pp-env-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"pp-config-label",children:["环境变量",l.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[De," 项"]})]}),l.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),l.jsx("button",{type:"button",className:"pp-icon-btn",title:At?"隐藏值":"显示值",onClick:()=>ut(ue=>!ue),children:At?l.jsx(uz,{className:"pp-ic"}):l.jsx(ZL,{className:"pp-ic"})})]}),l.jsxs("button",{type:"button",className:"pp-env-add",onClick:_t,disabled:ie,children:[l.jsx(ir,{className:"pp-ic"}),"添加变量"]}),(Ye.length>0||xt.length>0)&&l.jsxs("div",{className:"pp-env-table",children:[Ye.length>0&&l.jsxs("div",{className:"pp-env-group",children:[l.jsxs("div",{className:"pp-env-group-head",children:[l.jsx("span",{children:"组件自动生成"}),l.jsxs("small",{children:[Ye.length," 项"]})]}),Ye.map(ue=>{const _e=ue.key.startsWith("ENABLE_");return l.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[l.jsx("input",{className:"pp-env-key-fixed",value:ue.key,readOnly:!0,disabled:ie,"aria-label":`${ue.key} 环境变量名`}),l.jsx("input",{type:_e||At?"text":"password",value:ue.value,placeholder:ue.required?"必填,尚未填写":"可选,尚未填写",readOnly:_e,disabled:ie||!_e&&!b,autoComplete:"off","aria-label":`${ue.key} 环境变量值`,onChange:ve=>b==null?void 0:b(ue.key,ve.currentTarget.value)}),l.jsx("span",{className:"pp-env-source",children:_e?"自动":"同步"})]},ue.key)})]}),xt.length>0&&l.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[l.jsx("span",{children:"自定义变量"}),l.jsxs("small",{children:[xt.length," 项"]})]}),xt.map(ue=>l.jsxs("div",{className:"pp-env-row",children:[l.jsx("input",{value:ue.key,placeholder:"名称",disabled:ie,autoComplete:"off",onChange:_e=>dt(ue.id,{key:_e.currentTarget.value})}),l.jsx("input",{type:At?"text":"password",value:ue.value,placeholder:"值",disabled:ie,autoComplete:"off",onChange:_e=>dt(ue.id,{value:_e.currentTarget.value})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:ie,onClick:()=>Lt(ue.id),children:l.jsx(Zr,{className:"pp-ic"})})]},ue.id))]})]}),(ie||me||Object.keys(Ie).length>0)&&l.jsxs("section",{className:"pp-config-section pp-progress-section",children:[l.jsx("div",{className:"pp-config-label",children:"部署进度"}),l.jsx("ol",{className:"pp-steps",children:D.map((ue,_e)=>{const ve=Ce?D.findIndex(ct=>ct.phase===Ce):-1,ye=!!we&&(ve===-1?_e===0:_e===ve);let nt;me?nt="done":ye?nt="failed":ve===-1?nt=ie?"active":"pending":_eue.phase===Ce))==null?void 0:Mn.label)??Ce}阶段):`:""}${we}`,onRetry:an,retryLabel:L?"重试更新":"重试部署"}),me&&l.jsxs("section",{className:"pp-deploy-result",children:[l.jsx("div",{className:"pp-deploy-result-header",children:L?"更新成功":"部署成功"}),l.jsxs("div",{className:"pp-deploy-result-body",children:[me.region&&l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"区域"}),l.jsx("code",{children:me.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"Agent 名称"}),l.jsx("code",{children:me.agentName})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"API 端点"}),l.jsx("code",{className:"pp-deploy-result-url",children:me.url})]})]}),l.jsxs("div",{className:"pp-deploy-result-actions",children:[l.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:Bt,disabled:Ge,children:[Ge?l.jsx(Kt,{className:"pp-ic spin"}):l.jsx(iM,{className:"pp-ic"}),Ge?"连接中…":"立即对话"]}),me.consoleUrl&&l.jsxs("a",{href:me.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[l.jsx(ev,{className:"pp-ic"}),"控制台"]})]})]})]}),l.jsx("div",{className:"pp-config-actions",children:l.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:an,disabled:ie||te||F||!!n,title:n,children:ie?`${f}中…`:we?`重试${f}`:f})})]})]}),J&&r&&Us.createPortal(l.jsx("div",{className:"pp-flow-backdrop",onMouseDown:ue=>{ue.target===ue.currentTarget&&fe(!1)},children:l.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[l.jsxs("header",{children:[l.jsxs("div",{children:[l.jsx("strong",{children:"执行流程"}),l.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),l.jsx("button",{type:"button",onClick:()=>fe(!1),"aria-label":"关闭执行流程预览",children:l.jsx(Zr,{"aria-hidden":!0})})]}),l.jsx("div",{className:"pp-flow-dialog-canvas",children:l.jsx(yg,{draft:r,direction:"horizontal",selectedPath:[],onSelect:Ia,onAdd:Ia,onInsert:Ia,onDelete:Ia,readOnly:!0,interactivePreview:!0})})]})}),document.body),l.jsx(zge,{open:ee,isUpdate:L,onCancel:zt,onConfirm:()=>void Ht()})]})}const AC="dogfooding",Lb="dogfooding",Mb="dogfooding_b";let Jge=0;const jb=()=>++Jge;function CC(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function e0e(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function IC(e){const t=[],n=e0e(e);t.push(n);const r=n.indexOf("{"),s=n.lastIndexOf("}");r>=0&&s>r&&t.push(n.slice(r,s+1));for(const i of t)try{const a=JSON.parse(i);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await pv(D_(a))}catch{}return null}function t0e({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:s}){const[i,a]=E.useState([{id:jb(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,c]=E.useState(""),[u,d]=E.useState(!1),[f,h]=E.useState(null),[p,m]=E.useState(null),[g,x]=E.useState(!1),[y,w]=E.useState(null),[b,_]=E.useState(null),[k,N]=E.useState(!1),[A,S]=E.useState(!1),[C,R]=E.useState({}),O=E.useRef(null),F=E.useRef(null),q=E.useRef(null),L=E.useRef(null),D=E.useRef(null);E.useEffect(()=>{const Q=L.current;Q&&Q.scrollTo({top:Q.scrollHeight,behavior:"smooth"})},[i,u]),E.useEffect(()=>{const Q=D.current;Q&&(Q.style.height="auto",Q.style.height=Math.min(Q.scrollHeight,160)+"px")},[o]);const T=Q=>a(ee=>[...ee,{id:jb(),role:"assistant",text:Q}]);async function M(){if(O.current)return O.current;const Q=await Vm(AC,e);return O.current=Q,Q}async function j(Q,ee){if(ee.current)return ee.current;const ce=await Vm(Q,e);return ee.current=ce,ce}async function U(Q,ee){if(!C[Q])try{const ce=await fv(ee);R(J=>({...J,[Q]:ce.model||ee}))}catch{R(ce=>({...ce,[Q]:ee}))}}async function I(Q,ee,ce){const J=await j(Q,ee);let fe=si();for await(const ge of bf({appName:Q,userId:e,sessionId:J,text:ce}))fe=Pc(fe,ge);const te=CC(fe).trim();return{project:await IC(te),finalText:te}}const K=async(Q,ee,ce)=>t0(Q.name,Q.files,{region:"cn-beijing",projectName:"default"},{...ce,onStage:ee}),W=async()=>{const Q=o.trim();if(!(!Q||u)){if(a(ee=>[...ee,{id:jb(),role:"user",text:Q}]),c(""),h(null),d(!0),g){w(null),_(null),N(!0),S(!0),U("a",Lb),U("b",Mb);const ee=I(Lb,F,Q).then(({project:J})=>(w(J),J)).catch(J=>{const fe=J instanceof Error?J.message:String(J);return h(fe),null}).finally(()=>N(!1)),ce=I(Mb,q,Q).then(({project:J})=>(_(J),J)).catch(J=>{const fe=J instanceof Error?J.message:String(J);return h(fe),null}).finally(()=>S(!1));try{const[J,fe]=await Promise.all([ee,ce]),te=[J?`方案 A:${J.name}`:null,fe?`方案 B:${fe.name}`:null].filter(Boolean);te.length?T(`已生成两个方案(${te.join(",")}),请在右侧对比后采用其一。`):T("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const ee=await M();let ce=si();for await(const te of bf({appName:AC,userId:e,sessionId:ee,text:Q}))ce=Pc(ce,te);const J=CC(ce).trim(),fe=await IC(J);fe?(m(fe),T(`已生成项目:${fe.name}(${fe.files.length} 个文件),可在右侧预览和编辑。`)):T(J||"(助手没有返回内容,请再描述一下你的需求。)")}catch(ee){const ce=ee instanceof Error?ee.message:String(ee);h(ce),T(`抱歉,调用智能构建助手失败:${ce}`)}finally{d(!1)}}},B=Q=>{const ee=Q==="a"?y:b;if(!ee)return;m(ee),x(!1),w(null),_(null),N(!1),S(!1);const ce=Q==="a"?"A":"B",J=Q==="a"?C.a:C.b;T(`已采用方案 ${ce}(${J??(Q==="a"?Lb:Mb)}),可继续编辑。`)},ie=Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.nativeEvent.isComposing&&(Q.preventDefault(),W())};return l.jsx("div",{className:"ic-root",children:l.jsxs("div",{className:"ic-body",children:[l.jsxs("div",{className:"ic-chat",children:[l.jsxs("div",{className:"ic-transcript",ref:L,children:[l.jsx(ni,{initial:!1,children:i.map(Q=>l.jsxs(Wt.div,{className:`ic-turn ic-turn--${Q.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[Q.role==="assistant"&&l.jsx("div",{className:"ic-avatar",children:l.jsx(tl,{className:"ic-avatar-icon"})}),l.jsx("div",{className:"ic-bubble",children:Q.role==="assistant"?l.jsx(sh,{text:Q.text}):Q.text})]},Q.id))}),u&&l.jsxs(Wt.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[l.jsx("div",{className:"ic-avatar",children:l.jsx(tl,{className:"ic-avatar-icon"})}),l.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"})]})]})]}),f&&l.jsxs("div",{className:"ic-error",children:[l.jsx(qg,{className:"ic-error-icon"}),f]}),l.jsxs("div",{className:"ic-composer",children:[l.jsxs("div",{className:"ic-composer-box",children:[l.jsx("textarea",{ref:D,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:Q=>c(Q.target.value),onKeyDown:ie,disabled:u}),l.jsx("button",{className:"ic-send",onClick:()=>void W(),disabled:!o.trim()||u,title:"发送 (Enter)",children:l.jsx(Pz,{className:"ic-send-icon"})})]}),l.jsxs("div",{className:"ic-composer-foot",children:[l.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[l.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:g,disabled:u,onChange:Q=>x(Q.target.checked)}),l.jsx("span",{className:"ic-ab-track",children:l.jsx("span",{className:"ic-ab-thumb"})}),l.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),l.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),l.jsx("aside",{className:"ic-preview",children:g?l.jsxs("div",{className:"ic-compare",children:[l.jsx(RC,{side:"a",project:y,loading:k,model:C.a,onAdopt:()=>B("a")}),l.jsx("div",{className:"ic-compare-divider"}),l.jsx(RC,{side:"b",project:b,loading:A,model:C.b,onAdopt:()=>B("b")})]}):p?l.jsx(U0,{project:p,onChange:m,onDeploy:K,onAgentAdded:r,onDeploymentTaskChange:s}):l.jsxs("div",{className:"ic-preview-empty",children:[l.jsxs("div",{className:"ic-preview-empty-icon",children:[l.jsx(yz,{className:"ic-preview-empty-glyph"}),l.jsx(nl,{className:"ic-preview-empty-spark"})]}),l.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),l.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function RC({side:e,project:t,loading:n,model:r,onAdopt:s}){const i=e==="a"?"方案 A":"方案 B";return l.jsxs("div",{className:"ic-pane",children:[l.jsxs("div",{className:"ic-pane-head",children:[l.jsxs("div",{className:"ic-pane-title",children:[l.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:i}),r&&l.jsx("span",{className:"ic-pane-model",children:r})]}),l.jsxs("button",{className:"ic-adopt",onClick:s,disabled:!t||n,title:`采用${i}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),l.jsx("div",{className:"ic-pane-body",children:n?l.jsxs("div",{className:"ic-pane-loading",children:[l.jsx(Kt,{className:"ic-pane-spinner"}),l.jsx("span",{children:"正在生成…"})]}):t?l.jsx(U0,{project:t}):l.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const n0e=/^[A-Za-z_][A-Za-z0-9_]*$/;function Sc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":n0e.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function _5(e){const t=new Set,n=new Set,r=s=>{Sc(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(r)};return r(e),n}function r0e({className:e,...t}){return l.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:[l.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"}),l.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 Ju={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:r0e},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:bz},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:Fz},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:nv},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:Xg}},s0e=[Ju.llm,Ju.sequential,Ju.parallel,Ju.loop,Ju.a2a],k5=e=>e==="sequential"||e==="parallel"||e==="loop",$0=e=>e==="a2a";function Hs(e){return e.trimEnd().replace(/[。.]+$/,"")}function vg(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(r=>r==null?void 0:r.toLocaleLowerCase().includes(n)):!0}function _o(e,t){return e[t]|e[t+1]<<8}function Ll(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function i0e(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 N5(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(Ll(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const s=_o(e,r+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let i=Ll(e,r+16);const a=new TextDecoder("utf-8"),o=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const w=_o(e,x+26),b=_o(e,x+28),_=x+30+w+b,k=e.subarray(_,_+f);let N;if(d===0)N=k;else if(d===8)N=await i0e(k);else{i+=46+p+m+g;continue}o.push({name:y,text:a.decode(N)}),i+=46+p+m+g}return o}const a0e="/skillhub/v1/skills";async function o0e(e,t="public"){const n=e.trim(),r=`${a0e}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(r,{headers:{accept:"application/json"},signal:ci(void 0,cu)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function l0e({selected:e,onChange:t}){const[n,r]=E.useState(""),[s,i]=E.useState([]),[a,o]=E.useState(!1),[c,u]=E.useState(null),[d,f]=E.useState(!1),h=g=>e.some(x=>x.source==="skillhub"&&x.slug===g),p=g=>{g.slug&&(h(g.slug)?t(e.filter(x=>!(x.source==="skillhub"&&x.slug===g.slug))):t([...e,{source:"skillhub",slug:g.slug,name:g.name,folder:g.slug.split("/").pop()||g.name,namespace:g.namespace||"public",description:g.description}]))},m=async g=>{o(!0),u(null),f(!0);try{const x=await o0e(g);i(x)}catch(x){u(x instanceof Error?x.message:"搜索失败,请稍后重试。"),i([])}finally{o(!1)}};return E.useEffect(()=>{const g=n.trim();if(!g){i([]),f(!1),u(null);return}const x=setTimeout(()=>m(g),300);return()=>clearTimeout(x)},[n]),l.jsxs("div",{className:"cw-skillhub",children:[l.jsxs("div",{className:"cw-skill-searchrow",children:[l.jsxs("div",{className:"cw-skill-searchbox",children:[l.jsx(yf,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),l.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:g=>r(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),n.trim()&&m(n))}})]}),l.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?l.jsx(Kt,{className:"cw-i cw-spin"}):l.jsx(yf,{className:"cw-i"}),"搜索"]})]}),c&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:c})]}),a&&s.length===0?l.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):s.length>0?l.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const x=h(g.slug||"");return l.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>p(g),"aria-pressed":x,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:g.name}),g.description&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(g.description)}),g.sourceRepo&&l.jsx("span",{className:"cw-skill-result-repo",children:g.sourceRepo})]})]},g.id||g.slug)})}):d&&!c?l.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&l.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const gx=/(^|\/)skill\.md$/i;function c0e(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let s=1;s=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function u0e(...e){var t;for(const n of e){const r=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(r)return r.slice(0,64)}return"local-skill"}function d0e(e,t){return t.trim()||e}function S5(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(s=>({path:s.path.slice(r.length),text:s.text}))}return t}function f0e(e){const t=new Map,n=new Set;for(const r of e)if(gx.test("/"+r.path)){const s=r.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const r of e){const s=r.path.split("/");let i="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){i=d;break}}const a=gx.test("/"+r.path);if(!i&&!a&&!n.has("")||!n.has(i)&&!a)continue;const o=i?r.path.slice(i.length+1):r.path,c=t.get(i)||[];c.push({path:o,text:r.text}),t.set(i,c)}return t}function h0e(e,t,n){const r=`${n}${e?"/"+e:""}`,s=t.find(c=>gx.test("/"+c.path));if(!s)return{hit:null,error:`${r} 缺少 SKILL.md`};const i=l0e(s.text),a=u0e(i.name,e,n.replace(/\.[^.]+$/,"")),o=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${c.path}`};o.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:d0e(a,i.name),description:i.description||"本地 Skill",folder:a,localFiles:o},error:null}}async function p0e(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await N5(t)).map(s=>({path:s.name,text:s.text}));return T5(S5(r),e.name)}async function m0e(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function y0e(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((s,i)=>t.readEntries(s,i));if(r.length===0)return n;n.push(...r)}}async function A5(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await g0e(e),path:n}];if(!e.isDirectory)return[];const r=await y0e(e);return(await Promise.all(r.map(s=>A5(s,n)))).flat()}function b0e({selected:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState([]),[a,o]=E.useState(!1),[c,u]=E.useState(!1),d=E.useRef(0),f=b=>e.some(_=>_.source==="local"&&_.folder===b),h=b=>{b.localFiles&&(f(b.folder||b.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(b.folder||b.name)))):t([...e,{source:"local",folder:b.folder||b.name,name:b.name,description:b.description,localFiles:b.localFiles}]))},p=E.useRef([]),m=E.useRef(e);E.useEffect(()=>{p.current=s},[s]),E.useEffect(()=>{m.current=e},[e]);const g=b=>{const _=new Set([...p.current.map(S=>S.folder||S.name),...m.current.filter(S=>S.source==="local").map(S=>S.folder)]),k=[],N=[];for(const S of b.hits){const C=S.folder||S.name;if(_.has(C)){k.push(S.name);continue}_.add(C),N.push(S)}i(S=>[...S,...N]);const A=[...b.errors];if(k.length>0&&A.push(`已跳过重复技能:${k.join("、")}`),r(A),N.length===1&&b.errors.length===0&&k.length===0){const S=N[0];S.localFiles&&t([...m.current,{source:"local",folder:S.folder||S.name,name:S.name,description:S.description,localFiles:S.localFiles}])}},x=b=>{b.preventDefault(),d.current+=1,u(!0)},y=b=>{b.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},w=async b=>{if(b.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(b.dataTransfer.items).map(k=>{var N;return(N=k.webkitGetAsEntry)==null?void 0:N.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(S=>A5(S)))).flat(),N=_.some(S=>S.isDirectory);if(!N&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){g(await p0e(k[0].file));return}if(!N){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const A=new Map(k.map(({file:S,path:C})=>[S,C]));g(await m0e(k.map(({file:S})=>S),A))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return l.jsxs("div",{className:"cw-local",children:[l.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:x,onDragOver:b=>b.preventDefault(),onDragLeave:y,onDrop:b=>void w(b),children:[l.jsx(tv,{className:"cw-local-drop-icon","aria-hidden":!0}),l.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),l.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&l.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:n.join(";")})]}),s.length>0&&l.jsx("div",{className:"cw-skill-results",children:s.map(b=>{var k;const _=f(b.folder||b.name);return l.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(b),"aria-pressed":_,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(b.description)}),l.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=b.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},b.id)})})]})}function E0e({selected:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState([]),[a,o]=E.useState(""),[c,u]=E.useState(!0),[d,f]=E.useState(!1),[h,p]=E.useState(null);E.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const w=await JM();y||(r(w),w.length>0&&o(w[0].id))}catch(w){y||p(w instanceof Error?w.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),E.useEffect(()=>{if(!a){i([]);return}const y=n.find(b=>b.id===a);let w=!1;return(async()=>{f(!0),p(null);try{const b=await e3(a,y==null?void 0:y.region);w||i(b)}catch(b){w||p(b instanceof Error?b.message:"加载失败")}finally{w||f(!1)}})(),()=>{w=!0}},[a,n]);const m=n.find(y=>y.id===a),g=(y,w)=>e.some(b=>b.source==="skillspace"&&b.skillId===y&&(b.version||"")===w),x=y=>{if(m)if(g(y.skillId,y.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===y.skillId&&(w.version||"")===y.version)));else{const w=lK(m,y);t([...e,{source:"skillspace",folder:w.folder||y.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return l.jsx("div",{className:"cw-skillspace",children:c?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Kt,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:h})]}):n.length===0?l.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-skillspace-header",children:[l.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:y=>o(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>l.jsxs("option",{value:y.id,children:[y.name||y.id,y.region?` [${y.region}]`:"",y.description?` — ${Hs(y.description)}`:""]},y.id))}),m&&l.jsx("a",{href:cK(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:l.jsx(ev,{className:"cw-i cw-i-sm"})})]}),d?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Kt,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?l.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):l.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const w=g(y.skillId,y.version);return l.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>x(y),"aria-pressed":w,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&l.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(y.skillDescription)}),l.jsxs("span",{className:"cw-skill-result-repo",children:[l.jsx(az,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function x0e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,lu)});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 w0e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await x0e(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function v0e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,lu)});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 _0e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await v0e(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const k0e=E.lazy(()=>kc(()=>import("./MarkdownPromptEditor-7jWSKsBd.js"),__vite__mapDeps([0,1])));function N0e(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r)}const OC=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Bz,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:uo,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:lz},{id:"tools",label:"工具",hint:"可调用的能力",icon:lM},{id:"skills",label:"技能",hint:"声明式技能",icon:nl},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Kp},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:rM},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:XL},{id:"review",label:"完成",hint:"预览并创建",icon:jz}];function S0e({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),l.jsx("path",{d:"M3 10v4",opacity:"0.45"}),l.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function C5({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7 9 5 5 5-5"})})}function I5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),l.jsx("path",{d:"M4.5 4.75v3.5H8"}),l.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),l.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const T0e={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},LC={llm:"理解任务并完成一个具体工作",sequential:"内部步骤按照顺序依次执行",parallel:"内部步骤同时工作,完成后统一汇总",loop:"重复执行内部步骤,直到满足停止条件",a2a:"调用已经存在的远程 Agent"},MC={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},R5="REGISTRY_SPACE_ID",A0e=t3.filter(e=>e.key!==R5);function O5(e,t){var r,s,i;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||ui.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||ui.region,n.REGISTRY_ENDPOINT=((i=e.registryEndpoint)==null?void 0:i.trim())||ui.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function jC({items:e,selected:t,onToggle:n,scrollRows:r}){return l.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(s=>{const i=t.includes(s.id);return l.jsxs("button",{type:"button",className:`cw-check ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:[l.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:i&&l.jsx(pi,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-check-text",children:[l.jsx("span",{className:"cw-check-title",children:s.label}),l.jsx("span",{className:"cw-check-desc",children:Hs(s.desc)})]})]},s.id)})})}function Db({options:e,value:t,onChange:n}){return l.jsx("div",{className:"cw-segmented",children:e.map(r=>{var i;const s=(t??((i=e[0])==null?void 0:i.id))===r.id;return l.jsxs("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":s,title:Hs(r.desc),children:[l.jsx("span",{className:"cw-seg-title",children:r.label}),l.jsx("span",{className:"cw-seg-desc",children:Hs(r.desc)})]},r.id)})})}function C0e(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Ml({env:e,values:t,onChange:n}){return e.length===0?l.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):l.jsx("div",{className:"cw-env-fields",children:e.map(r=>l.jsxs("label",{className:"cw-env-field",children:[l.jsxs("span",{className:"cw-env-field-head",children:[l.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&l.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&l.jsx("code",{title:r.key,children:r.key})]}),l.jsx("input",{className:"cw-input",type:C0e(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:s=>n(r.key,s.currentTarget.value)})]},r.key))})}function Pb(e){return e.name.trim()||"未命名智能体中心"}function Bb(e){return e.name.trim()||e.id||"未命名知识库"}function I0e({value:e,region:t,invalid:n,onChange:r}){const s=t.trim()||ui.region,[i,a]=E.useState([]),[o,c]=E.useState(!1),[u,d]=E.useState(null),[f,h]=E.useState(0),[p,m]=E.useState(!1),[g,x]=E.useState(""),y=E.useRef(null);E.useEffect(()=>{let C=!1;return c(!0),d(null),w0e({region:s}).then(R=>{C||a(R)}).catch(R=>{C||(a([]),d(R instanceof Error?R.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[s,f]);const w=!e||i.some(C=>C.id===e.trim()),b=i.find(C=>C.id===e.trim()),_=b?Pb(b):e&&!w?"已选择的智能体中心":"请选择智能体中心",k=o&&i.length===0,N=E.useMemo(()=>i.filter(C=>vg(g,[Pb(C),C.id,C.projectName])),[g,i]),A=!!(e&&!w&&vg(g,["已选择的智能体中心",e]));E.useEffect(()=>{if(!p)return;const C=O=>{const F=O.target;F instanceof Node&&y.current&&!y.current.contains(F)&&m(!1)},R=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",R),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",R)}},[p]);const S=C=>{r(C),m(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:k,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{x(""),m(C=>!C)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:_}),l.jsx(C5,{className:"cw-a2a-space-trigger-icon"})]}),p&&l.jsxs("div",{className:"cw-a2a-space-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:g,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>x(C.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[A&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S(e),children:"已选择的智能体中心"}),N.map(C=>{const R=Pb(C),O=C.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":O,className:`cw-a2a-space-option ${O?"is-selected":""}`,title:`${R} (${C.id})`,onClick:()=>S(C.id),children:R},C.id)}),!A&&N.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:o,onClick:()=>h(C=>C+1),children:o?l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(I5,{className:"cw-i cw-i-sm"})})]}),u?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:u})]}):o?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):i.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",i.length," 个智能体中心,列表仅展示中心名称。"]})]})}function R0e({value:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState(!1),[a,o]=E.useState(null),[c,u]=E.useState(0),[d,f]=E.useState(!1),[h,p]=E.useState(""),m=E.useRef(null);E.useEffect(()=>{let N=!1;return i(!0),o(null),_0e().then(A=>{N||r(A)}).catch(A=>{N||(r([]),o(A instanceof Error?A.message:"加载失败"))}).finally(()=>{N||i(!1)}),()=>{N=!0}},[c]);const g=!e||n.some(N=>N.id===e.trim()),x=n.find(N=>N.id===e.trim()),y=x?Bb(x):e&&!g?e:"请选择 VikingDB 知识库",w=s&&n.length===0,b=E.useMemo(()=>n.filter(N=>vg(h,[Bb(N),N.id,N.description,N.projectName])),[n,h]),_=!!(e&&!g&&vg(h,[e]));E.useEffect(()=>{if(!d)return;const N=S=>{const C=S.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},A=S=>{S.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",N),window.addEventListener("keydown",A),()=>{window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",A)}},[d]);const k=N=>{t(N),f(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:w,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(N=>!N)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:y}),l.jsx(C5,{className:"cw-a2a-space-trigger-icon"})]}),d&&l.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:N=>p(N.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[_&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:e}),b.map(N=>{const A=Bb(N),S=N.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":S,className:`cw-a2a-space-option ${S?"is-selected":""}`,title:`${A} (${N.id})`,onClick:()=>k(N.id),children:A},N.id)}),!_&&b.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:s,onClick:()=>u(N=>N+1),children:s?l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(I5,{className:"cw-i cw-i-sm"})})]}),a?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:a})]}):s?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 VikingDB 知识库…"]}):n.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function O0e({tools:e,onChange:t}){const n=(i,a)=>t(e.map((o,c)=>c===i?{...o,...a}:o)),r=i=>t(e.filter((a,o)=>o!==i)),s=()=>t([...e,{name:"",transport:"http",url:""}]);return l.jsxs("div",{className:"cw-mcp",children:[e.length>0&&l.jsx("div",{className:"cw-mcp-list",children:l.jsx(ni,{initial:!1,children:e.map((i,a)=>l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-mcp-rowhead",children:[l.jsxs("div",{className:"cw-mcp-transport",children:[l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":i.transport==="http",children:l.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":i.transport==="stdio",children:l.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:l.jsx(js,{className:"cw-i cw-i-sm"})})]}),l.jsx("input",{className:"cw-input",value:i.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),i.transport==="http"?l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),l.jsx("input",{className:"cw-input",value:i.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),l.jsx("input",{className:"cw-input",value:(i.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),l.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),l.jsxs("button",{type:"button",className:"cw-add-sub",onClick:s,children:[l.jsx(ir,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&l.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function L5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.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"}),l.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),l.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"}),l.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function L0e({s:e,onRemove:t}){let n=nl,r="火山 Find Skill 技能广场";return e.source==="local"?(n=tv,r="本地"):e.source==="skillspace"&&(n=L5,r="AgentKit Skills 中心"),l.jsxs(Wt.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:[l.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:l.jsx(n,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-selected-skill-meta",children:[l.jsx("span",{className:"cw-selected-skill-name",children:e.name}),l.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${Hs(e.description)}`:""]})]}),l.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:l.jsx(Zr,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Fb=[{id:"local",label:"本地文件",icon:tv},{id:"skillspace",label:"AgentKit Skills 中心",icon:L5},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Xg}];function M0e({selected:e,onChange:t}){const[n,r]=E.useState("local"),[s,i]=E.useState(!1),a=Fb.findIndex(c=>c.id===n),o=c=>t(e.filter(u=>Ub(u)!==c));return E.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&i(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),l.jsxs("div",{className:"cw-skillspane",children:[l.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>i(!0),children:[l.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:l.jsx(ir,{className:"cw-i"})}),l.jsx("span",{children:"添加 Skill"})]}),e.length>0&&l.jsxs("div",{className:"cw-skill-selected",children:[l.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),l.jsx("div",{className:"cw-selected-skill-list",children:l.jsx(ni,{initial:!1,children:e.map(c=>l.jsx(L0e,{s:c,onRemove:()=>o(Ub(c))},Ub(c)))})})]}),l.jsx(ni,{children:s&&l.jsx(Wt.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&i(!1)},children:l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-skill-dialog-head",children:[l.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),l.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>i(!1),children:l.jsx(Zr,{className:"cw-i"})})]}),l.jsxs("div",{className:"cw-skill-dialog-body",children:[l.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Fb.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[l.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Fb.map(({id:c,label:u,icon:d})=>l.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:()=>r(c),children:[l.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),l.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&l.jsx(o0e,{selected:e,onChange:t}),n==="local"&&l.jsx(b0e,{selected:e,onChange:t}),n==="skillspace"&&l.jsx(E0e,{selected:e,onChange:t})]})]})]})})})]})}function Ub(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Ju({checked:e,onChange:t,title:n,desc:r,icon:s}){return l.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[l.jsx("span",{className:"cw-toggle-icon",children:l.jsx(s,{className:"cw-i"})}),l.jsxs("span",{className:"cw-toggle-text",children:[l.jsx("span",{className:"cw-toggle-title",children:n}),l.jsx("span",{className:"cw-toggle-desc",children:Hs(r)})]}),l.jsx("span",{className:"cw-switch","aria-hidden":!0,children:l.jsx(Wt.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function j0e(e,t){var r;let n=e;for(const s of t)if(n=(r=n.subAgents)==null?void 0:r[s],!n)return!1;return!0}function Tp(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function bh(e,t,n){if(t.length===0)return n(e);const[r,...s]=t,i=e.subAgents.slice();return i[r]=bh(i[r],s,n),{...e,subAgents:i}}function D0e(e,t){return bh(e,t,n=>({...n,subAgents:[...n.subAgents,jr()]}))}function P0e(e,t,n){return bh(e,t,r=>{const s=r.subAgents.slice();return s.splice(n,0,jr()),{...r,subAgents:s}})}function B0e(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return bh(e,n,s=>({...s,subAgents:s.subAgents.filter((i,a)=>a!==r)}))}const yx=e=>!$0(e.agentType),DC=3;function F0e(e,t,n=!1){var s;if($0(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const r=Nc(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":k5(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function M5(e,t,n=[]){const r=[],s=$0(e.agentType),i=F0e(e,t,n.length===0);return i&&r.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",problem:i}),yx(e)&&e.subAgents.forEach((a,o)=>r.push(...M5(a,t,[...n,o]))),r}function j5(e){return 1+e.subAgents.reduce((t,n)=>t+j5(n),0)}function D5(e){const t=[],n={},r=i=>{var a,o,c,u;for(const d of i.builtinTools??[]){const f=rl.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=i.a2aRegistry)!=null&&a.enabled&&(t.push({env:t3}),Object.assign(n,O5(i.a2aRegistry,{includeDefaults:!0}))),i.memory.shortTerm&&t.push({env:((o=bE.find(d=>d.id===(i.shortTermBackend??"local")))==null?void 0:o.env)??[]}),i.memory.longTerm&&t.push({env:((c=EE.find(d=>d.id===(i.longTermBackend??"local")))==null?void 0:c.env)??[]}),i.knowledgebase&&t.push({env:((u=xE.find(d=>d.id===(i.knowledgebaseBackend??Fc)))==null?void 0:u.env)??[]}),i.tracing)for(const d of i.tracingExporters??[]){const f=wE.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}i.subAgents.forEach(r)};r(e);const s=x5(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function P5(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function U0e(e){var n;const t=e.name.trim();return t||(e.agentType!=="sequential"?"":((n=e.subAgents.find(r=>r.name.trim()))==null?void 0:n.name.trim())??"")}function B5(e){var r,s;const t=D5(e),n={...((r=e.deployment)==null?void 0:r.envValues)??{},...t.fixedValues};return{...P5(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(w5(t.specs,n).map(({key:i,value:a})=>[i,a]))}}}function $0e(e){return JSON.stringify(B5(e))}function _g(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function cc(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function H0e({enabled:e,disabledReason:t,variants:n,draftSnapshot:r,input:s,onInput:i,onSend:a,onStartVariant:o,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p}){const m=n.filter(y=>y.phase!=="ready"?!1:y.runtimeSnapshot===_g(r,y)),g=n.some(y=>y.phase==="sending"),x=m.length>0&&!g;return l.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[l.jsx("div",{className:"cw-ab-stage",children:e?l.jsxs("div",{className:"cw-ab-grid",children:[n.map((y,w)=>{const b=y.modelName.trim(),_=y.description.trim(),k=y.instruction.trim(),N=cc(y),A=!!(b&&_&&k&&n.findIndex(T=>cc(T)===N)!==w),S=!b||!_||!k||A,C=!!(y.runtimeSnapshot&&y.runtimeSnapshot!==_g(r,y)),R=y.phase==="starting",O=y.phase==="ready"&&!C,F=R||y.phase==="sending",q=F||y.configOpen||S,L=b?_?k?A?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",D=R?"正在启动":C?"应用配置并重启":O||y.phase==="error"?"重新启动环境":"启动环境";return l.jsx("article",{className:"cw-ab-card",children:l.jsxs("div",{className:`cw-ab-card-inner${y.configOpen?" is-flipped":""}`,children:[l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":y.configOpen,children:[l.jsxs("header",{className:"cw-ab-card-head",children:[l.jsxs("div",{className:"cw-ab-card-title",children:[l.jsx("strong",{children:y.name}),l.jsx("span",{children:y.modelName||"默认模型"})]}),l.jsxs("div",{className:"cw-ab-card-actions",children:[l.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:y.configOpen||F,onClick:()=>f(y.id),children:"测试配置"}),y.id!=="baseline"&&l.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${y.name}`,disabled:y.configOpen||F,onClick:()=>d(y.id),children:l.jsx(js,{className:"cw-i"})})]})]}),l.jsx("div",{className:"cw-ab-conversation",children:y.error?l.jsx(wg,{message:y.error,className:"cw-debug-error-detail"}):R?l.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[l.jsx(Kt,{className:"cw-i cw-spin"}),l.jsx("span",{children:"正在创建独立测试环境"})]}):C?l.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:l.jsx("span",{children:"配置已变更,请重新启动此环境"})}):y.messages.length===0?l.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:O?l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),l.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):l.jsx("span",{className:"cw-ab-launch-hint",children:L||"启动环境后即可加入本轮测试"})}):y.messages.map((T,M)=>l.jsx("div",{className:`cw-debug-msg cw-debug-msg-${T.role}`,children:l.jsx("div",{className:"cw-debug-content",children:T.role==="user"?T.content:T.error?l.jsx(wg,{message:T.error,className:"cw-debug-msg-error"}):T.blocks&&T.blocks.length>0?l.jsx(E_,{blocks:T.blocks,onAction:()=>{}}):T.content?T.content:M===y.messages.length-1&&y.phase==="sending"?l.jsx(w6,{}):null})},M))}),l.jsxs("footer",{className:"cw-ab-deploy-footer",children:[l.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:q,title:L||void 0,onClick:()=>o(y.id),children:[O||C||y.phase==="error"?l.jsx(oM,{className:"cw-i"}):l.jsx(S0e,{className:"cw-i cw-debug-run-icon"}),D]}),l.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:F||!b,onClick:()=>c(y.id),children:"部署该配置"})]})]}),l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!y.configOpen,children:[l.jsxs("header",{className:"cw-ab-config-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"测试配置"}),l.jsx("span",{children:y.name})]}),l.jsxs("span",{className:`cw-ab-config-done-wrap${L?" is-disabled":""}`,tabIndex:L?0:void 0,children:[l.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!y.configOpen||S,onClick:()=>h(y.id),children:y.id==="baseline"?"完成配置":"完成并启动"}),L&&l.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:L})]})]}),l.jsxs("div",{className:"cw-ab-config",children:[l.jsxs("label",{children:[l.jsx("span",{children:"模型"}),l.jsx("input",{value:y.modelName,placeholder:"使用 Agent 当前模型",disabled:!y.configOpen,onChange:T=>p(y.id,"modelName",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"描述"}),l.jsx("textarea",{rows:2,value:y.description,disabled:!y.configOpen,onChange:T=>p(y.id,"description",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"系统提示词"}),l.jsx("textarea",{rows:5,value:y.instruction,disabled:!y.configOpen,onChange:T=>p(y.id,"instruction",T.target.value)})]}),l.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[l.jsxs("legend",{children:[l.jsx("span",{children:"优化选项"}),l.jsx("em",{children:"待开放"})]}),l.jsx("div",{className:"cw-ab-optimization-list",children:F5.map(T=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:y.optimizations.includes(T.id),disabled:!0}),l.jsx("span",{children:T.label})]},T.id))})]}),l.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},y.id)}),n.length<3&&l.jsxs("button",{type:"button",className:"cw-ab-add",onClick:u,children:[l.jsx(ir,{className:"cw-i"}),l.jsx("strong",{children:"添加对照组"}),l.jsx("span",{children:"最多同时创建 3 个测试组"})]})]}):l.jsx("div",{className:"cw-debug-empty",children:t})}),l.jsx("div",{className:"cw-ab-composer",children:l.jsxs("div",{className:"cw-debug-composerbox",children:[l.jsx("textarea",{className:"cw-debug-input",rows:1,value:s,placeholder:x?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!x,onChange:y=>i(y.target.value),onKeyDown:y=>{v6(y.nativeEvent)||y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),a())}}),l.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!x||!s.trim(),onClick:a,children:g?l.jsx(Kt,{className:"cw-i cw-spin"}):l.jsx(WL,{className:"cw-i"})})]})})]})}const PC=[{id:"build",label:"构建"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],F5=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function z0e({mode:e,agentName:t,busy:n,onChange:r,onDiscard:s}){const i=PC.findIndex(a=>a.id===e);return l.jsxs("header",{className:"cw-workspace-header",children:[l.jsx("div",{className:"cw-workspace-identity",children:l.jsx("strong",{title:t,children:t||"未命名 Agent"})}),l.jsx("nav",{className:"cw-workspace-stepper","aria-label":"Agent 创建步骤",children:PC.map((a,o)=>{const c=a.id===e,u=or(a.id),children:l.jsx("strong",{children:a.label})},a.id)})}),s&&l.jsx("div",{className:"cw-workspace-actions",children:l.jsx("button",{type:"button",className:"cw-discard-edit",disabled:n,onClick:s,children:"放弃编辑"})})]})}function V0e({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:s,onDeploymentTaskChange:i,deploymentTarget:a,onDeploymentComplete:o,onDeploymentStarted:c,onDraftChange:u,onDiscard:d}){var Jn,Ea,Hi,wl,vl,xa,wa,va,mo,_a,Vs,vt,z,re,Ee;const[f,h]=E.useState(()=>r??jr()),[p,m]=E.useState(""),[g,x]=E.useState(!1),[y,w]=E.useState(!1),[b,_]=E.useState(null),k=E.useRef(JSON.stringify(f)),N=E.useRef(k.current),A=JSON.stringify(f),S=A!==k.current,C=E.useRef(u);E.useEffect(()=>{C.current=u},[u]),E.useEffect(()=>{var $;A!==N.current&&(N.current=A,($=C.current)==null||$.call(C,f,S))},[f,S,A]);const[R,O]=E.useState("build"),[F,q]=E.useState(!1),[L,D]=E.useState(!1),[T,M]=E.useState(0),[j,U]=E.useState(null),[I,K]=E.useState(!1),[W,B]=E.useState((a==null?void 0:a.region)??"cn-beijing"),ie=(s==null?void 0:s.generatedAgentTestRun)===!0,Q=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[ee,ce]=E.useState(()=>[{id:"baseline",name:"基准组",modelName:(r??jr()).modelName??"",description:(r??jr()).description,instruction:(r??jr()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[J,fe]=E.useState("baseline"),te=E.useRef(1),ge=E.useRef(new Map),[we,Z]=E.useState(0),[me,Ne]=E.useState(""),[Ie,We]=E.useState("basic"),[Ce,et]=E.useState(""),[Ge,Xe]=E.useState(!1),[xt,gt]=E.useState(!1),[At,ut]=E.useState(!1),[X,ne]=E.useState(!1),[he,Te]=E.useState([]),He=E.useRef(null),qe=E.useRef({});E.useEffect(()=>()=>{for(const{run:$}of ge.current.values())ld($.runId).catch(le=>console.warn("清理调试运行失败",le));ge.current.clear()},[]);const Ut=E.useRef(null);Ut.current||(Ut.current=({meta:$,children:le})=>l.jsxs("section",{ref:Re=>{qe.current[$.id]=Re},id:`cw-sec-${$.id}`,"data-step-id":$.id,className:"cw-section",children:[l.jsx("header",{className:"cw-sec-head",children:l.jsxs("h2",{className:"cw-sec-title",children:[$.label,$.required&&l.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),le]}));const Ye=j0e(f,he)?he:[],De=Tp(f,Ye),Be=Ye.length===0,Ct=`cw-model-advanced-${Ye.join("-")||"root"}`,un=`cw-a2a-registry-advanced-${Ye.join("-")||"root"}`,$t=`cw-more-tool-types-${Ye.join("-")||"root"}`,wn=`cw-advanced-config-${Ye.join("-")||"root"}`,Fe=$=>h(le=>bh(le,Ye,Re=>({...Re,...$}))),dt=($,le)=>h(Re=>{var $e;return{...Re,deployment:{...Re.deployment??{feishuEnabled:!1},envValues:{...(($e=Re.deployment)==null?void 0:$e.envValues)??{},[$]:le}}}}),Lt=$=>Fe({a2aRegistry:{...De.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...$}}),_t=($,le)=>{if(!($ in MC))return;const Re=MC[$];Lt({[Re]:le}),dt($,le)},be=$=>{if(!(Be&&$==="a2a")){if($==="a2a"){Fe({agentType:$,a2aRegistry:{...De.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Fe({agentType:$,a2aRegistry:De.a2aRegistry?{...De.a2aRegistry,enabled:!1}:void 0})}},Ve=($,le)=>{h($),le&&Te(le)},st=async()=>{const $=p.trim();if(!(!$||g)&&!(S&&!window.confirm("生成的新配置会替换当前画布和属性,确定继续吗?"))){x(!0),w(!1),_(null),et("");try{const le=await FM($);h(D_(le.draft)),Te([]),U(null),D(!1),et(""),w(!0)}catch(le){_(le instanceof Error?le.message:"生成 Agent 配置失败")}finally{x(!1)}}},sn=$=>{const le=Tp(f,$);if(!yx(le)||$.length>=DC)return;const Re=D0e(f,$),$e=Tp(Re,$).subAgents.length-1;Ve(Re,[...$,$e])},an=($,le)=>{const Re=Tp(f,$);if(!yx(Re)||$.length>=DC)return;const $e=Math.max(0,Math.min(le,Re.subAgents.length)),pt=P0e(f,$,$e);Ve(pt,[...$,$e])},Ht=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(h(jr()),Te([]),D(!1),ne(!1))},zt=$=>{if($.length===0){Ht();return}Ve(B0e(f,$),$.slice(0,-1))},Bt=De.builtinTools??[],qt=De.mcpTools??[],vn=De.tracingExporters??[],Xt=De.selectedSkills??[],Ln=[De.memory.shortTerm,De.memory.longTerm,De.tracing].filter(Boolean).length,Mn=$=>Fe({builtinTools:Bt.includes($)?Bt.filter(le=>le!==$):[...Bt,$]}),ue=$=>{const le=vn.includes($)?vn.filter(Re=>Re!==$):[...vn,$];Fe({tracingExporters:le,tracing:le.length>0?!0:De.tracing})},_e=k5(De.agentType),ve=$0(De.agentType),ye=E.useMemo(()=>_5(f),[f]),nt=ve?null:Nc(De.name)??(ye.has(De.name)?"Agent 名称在当前结构中必须唯一":null),Qe=nt!==null,ct=!ve&&De.description.trim().length===0,ot=De.instruction.trim().length===0,oe=ve&&!((Jn=De.a2aRegistry)!=null&&Jn.registrySpaceId.trim()),Ze=$=>L&&$?`is-error cw-error-shake-${T%2}`:"",It=E.useMemo(()=>M5(f,ye),[f,ye]),it=It.length===0,kt=E.useMemo(()=>$0e(f),[f]),Ft=ee.find($=>$.id===J)??ee[0],Zn=E.useMemo(()=>D5(f),[f]),or=E.useMemo(()=>{var $,le,Re,$e;return{type:!0,basic:ve?!oe:!Qe&&(_e||!ot),model:!!(($=De.modelName)!=null&&$.trim()||(le=De.modelProvider)!=null&&le.trim()||(Re=De.modelApiBase)!=null&&Re.trim()),tools:Bt.length>0||qt.length>0,skills:Xt.length>0,knowledge:De.knowledgebase,advanced:De.memory.shortTerm||De.memory.longTerm||De.tracing,subagents:((($e=De.subAgents)==null?void 0:$e.length)??0)>0,review:it}},[De,Qe,ot,_e,ve,it,Bt,qt,Xt]),dn=_e||ve?["type","basic"]:["type","basic","model","tools","skills","knowledge",...Be?["advanced"]:[]],Zt=OC.filter($=>dn.includes($.id)),Yt=dn.join("|"),Jt=Ye.join("."),Mt=Zt.findIndex($=>$.id===Ie),Cn=$=>{var le;(le=qe.current[$])==null||le.scrollIntoView({behavior:"smooth",block:"start"})};E.useEffect(()=>{if(j)return;const $=He.current;if(!$)return;const le=Yt.split("|");let Re=0;const $e=()=>{Re=0;const at=le[le.length-1];let lt=le[0];if($.scrollTop+$.clientHeight>=$.scrollHeight-2)lt=at;else{const Yn=$.getBoundingClientRect().top+24;for(const yt of le){const er=qe.current[yt];if(!er||er.getBoundingClientRect().top>Yn)break;lt=yt}}lt&&We(Yn=>Yn===lt?Yn:lt)},pt=()=>{Re||(Re=window.requestAnimationFrame($e))};return $e(),$.addEventListener("scroll",pt,{passive:!0}),window.addEventListener("resize",pt),()=>{$.removeEventListener("scroll",pt),window.removeEventListener("resize",pt),Re&&window.cancelAnimationFrame(Re)}},[j,Yt,Jt]);const fn=()=>it?!0:(D(!0),M($=>$+1),It[0]&&(Te(It[0].path),window.requestAnimationFrame(()=>Cn("basic"))),!1),en=async()=>{const $=[...ge.current.values()];ge.current.clear(),Z(0),ce(le=>le.map(Re=>({...Re,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all($.map(async({run:le})=>{try{await ld(le.runId)}catch(Re){console.warn("清理调试运行失败",Re)}}))},Vn=async $=>{const le=ge.current.get($);if(le){ge.current.delete($),Z(ge.current.size);try{await ld(le.run.runId)}catch(Re){console.warn("清理调试运行失败",Re)}}},hn=async()=>R!=="validate"||we===0?!0:window.confirm("离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。")?(await en(),!0):!1,gr=async $=>{if(await hn()){if(et(""),!fn()){O("build");return}K(!0);try{const le=$?ee.find(pt=>pt.id===$):Ft;le&&fe(le.id);const Re=le?{...f,modelName:le.modelName||f.modelName,description:le.description,instruction:le.instruction}:f,$e=await pv(P5(Re));Re!==f&&h(Re),U($e),O("publish")}catch(le){et(le instanceof Error?le.message:String(le))}finally{K(!1)}}},Kn=async $=>{if(!ie||I||!fn())return;const le=ee.find(Rt=>Rt.id===$);if(!le||le.phase==="starting"||le.phase==="sending")return;const Re=le.modelName.trim(),$e=le.description.trim(),pt=le.instruction.trim(),at=cc(le),lt=ee.findIndex(Rt=>Rt.id===$),Yn=ee.findIndex(Rt=>cc(Rt)===at);if(!Re||!$e||!pt||Yn!==lt)return;const yt=_g(kt,le);ce(Rt=>Rt.map(cr=>cr.id===$?{...cr,configOpen:!1,phase:"starting",messages:[],error:null}:cr)),Ne("");let er=null;try{await Vn($);const Rt={...f,modelName:le.modelName||f.modelName,description:le.description,instruction:le.instruction};er=await UM(B5(Rt));const cr=await $M(er.runId,"test_user");ge.current.set($,{run:er,sessionId:cr}),Z(ge.current.size),ce(ur=>ur.map(_l=>_l.id===$?{..._l,phase:"ready",runtimeSnapshot:yt}:_l))}catch(Rt){if(er)try{await ld(er.runId)}catch(cr){console.warn("清理调试运行失败",cr)}ce(cr=>cr.map(ur=>ur.id===$?{...ur,phase:"error",runtimeSnapshot:"",error:Rt instanceof Error?Rt.message:String(Rt)}:ur))}},bs=async()=>{const $=me.trim(),le=ee.filter($e=>$e.phase==="ready"&&$e.runtimeSnapshot===_g(kt,$e)&&ge.current.has($e.id));if(!$||le.length===0)return;Ne("");const Re=new Set(le.map($e=>$e.id));ce($e=>$e.map(pt=>Re.has(pt.id)?{...pt,phase:"sending",messages:[...pt.messages,{role:"user",content:$},{role:"assistant",content:"",blocks:[]}]}:pt)),await Promise.all(le.map(async $e=>{const pt=ge.current.get($e.id);if(pt)try{let at=si();for await(const lt of HM({runId:pt.run.runId,userId:"test_user",sessionId:pt.sessionId,text:$})){const Yn=lt.error||lt.errorMessage||lt.error_message;if(ce(yt=>yt.map(er=>{if(er.id!==$e.id)return er;const Rt=[...er.messages],cr={...Rt[Rt.length-1]};return Yn?cr.error=String(Yn):(at=Dc(at,lt),cr.content=at.blocks.filter(ur=>ur.kind==="text").map(ur=>ur.text).join(""),cr.blocks=at.blocks),Rt[Rt.length-1]=cr,{...er,messages:Rt}})),Yn)break}}catch(at){ce(lt=>lt.map(Yn=>{if(Yn.id!==$e.id)return Yn;const yt=[...Yn.messages],er={...yt[yt.length-1]};return er.error=at instanceof Error?at.message:String(at),yt[yt.length-1]=er,{...Yn,messages:yt}}))}finally{ce(at=>at.map(lt=>lt.id===$e.id?{...lt,phase:"ready"}:lt))}}))},yr=()=>{ce($=>{if($.length>=3)return $;const le=te.current++,Re=`variant-${le}`;return[...$,{id:Re,name:`对照组 ${le}`,modelName:f.modelName??"",description:f.description,instruction:f.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},es=async $=>{await Vn($),ce(le=>le.filter(Re=>Re.id!==$)),J===$&&fe("baseline")},Es=($,le)=>ce(Re=>Re.map($e=>$e.id===$?{...$e,...le}:$e)),bi=($,le,Re)=>{Es($,{[le]:Re}),!(J!==$||$==="baseline")&&fe("baseline")},po=$=>{const le=ee.find(yt=>yt.id===$);if(!le)return;const Re=le.modelName.trim(),$e=le.description.trim(),pt=le.instruction.trim(),at=cc(le),lt=ee.findIndex(yt=>yt.id===$),Yn=ee.findIndex(yt=>cc(yt)===at);if(!(!Re||!$e||!pt||Yn!==lt)){if($==="baseline"){Es($,{configOpen:!1});return}Kn($)}},xs=async($,le,Re)=>{var at;const $e=(at=f.deployment)==null?void 0:at.network,pt=$e&&$e.mode&&$e.mode!=="public"?{mode:$e.mode,vpc_id:$e.vpcId,subnet_ids:$e.subnetIds,enable_shared_internet_access:$e.enableSharedInternetAccess}:void 0;return t0($.name,$.files,{region:(a==null?void 0:a.region)??W,projectName:"default",network:pt},{...Re,onStage:le,runtimeId:a==null?void 0:a.runtimeId,description:f.description})},Ei=()=>{fn()&&(ce($=>$.map(le=>le.id==="baseline"&&!ge.current.has(le.id)?{...le,modelName:f.modelName??"",description:f.description,instruction:f.instruction}:le)),O("validate"))},$i=async $=>{if($==="publish"){j?O("publish"):gr();return}if($==="validate"){Ei();return}await hn()&&O($)},Ur=Ut.current,Ar=$=>OC.find(le=>le.id===$);return l.jsxs("div",{className:"cw-root",children:[l.jsx(z0e,{mode:R,agentName:U0e(f),busy:I,onChange:$i,onDiscard:d?()=>{S?q(!0):d()}:void 0}),Ce&&l.jsx("div",{className:"cw-workspace-alert",role:"alert",children:Ce}),l.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[R==="build"&&l.jsxs("div",{className:"cw-build-workspace",children:[l.jsx("section",{className:`cw-ai-compose${g?" is-generating":""}${y?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:l.jsx(ni,{initial:!1,mode:"wait",children:y?l.jsxs(Wt.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:[l.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),l.jsx("strong",{children:"生成成功"}),l.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>w(!1),children:"重新生成"})]},"success"):l.jsxs(Wt.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:[l.jsxs("form",{className:"cw-ai-compose-form",onSubmit:$=>{$.preventDefault(),st()},children:[l.jsx("input",{type:"text",value:p,maxLength:8e3,disabled:g,placeholder:"输入您的目标",onChange:$=>m($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),st())}}),l.jsx("button",{type:"submit",disabled:g||!p.trim(),"aria-label":g?"正在智能生成":"智能生成",children:g?l.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:l.jsx("span",{})}):"智能生成"})]}),l.jsx("p",{className:"cw-ai-compose-note",children:"使用 doubao-seed-2-0-lite-260428 模型生成,将会产生 Token 消耗"})]},"compose")})}),l.jsxs("div",{className:"cw-editor",children:[l.jsx(yg,{draft:f,direction:"vertical",selectedPath:Ye,onSelect:Te,onAdd:sn,onInsert:an,onDelete:zt}),l.jsxs("div",{className:"cw-detail",children:[l.jsx("div",{className:"cw-detail-scroll",ref:He,children:l.jsx("div",{className:"cw-detail-inner",children:l.jsxs("div",{className:"cw-lower",children:[l.jsxs("div",{className:"cw-form-col",children:[l.jsx(Ur,{meta:Ar("type"),children:l.jsx("div",{className:"cw-agent-type-options",role:"radiogroup","aria-label":"Agent 类型",children:r0e.map($=>{const le=(De.agentType??"llm")===$.id,Re=Be&&$.id==="a2a",$e=Re?"cw-remote-agent-disabled-hint":void 0;return l.jsxs("label",{"data-agent-type":$.id,className:`cw-agent-type-option ${le?"is-on":""} ${Re?"is-disabled":""}`,title:Re?void 0:LC[$.id],tabIndex:Re?0:void 0,"aria-describedby":$e,children:[l.jsx("input",{type:"radio",name:"agentType",className:"cw-agent-type-radio",checked:le,disabled:Re,onChange:()=>be($.id)}),l.jsxs("span",{className:"cw-agent-type-copy",children:[l.jsx("strong",{children:T0e[$.id]}),l.jsx("small",{children:LC[$.id]})]}),Re&&l.jsx("span",{id:$e,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},$.id)})})}),l.jsx(Ur,{meta:Ar("basic"),children:l.jsxs("div",{className:"cw-form",children:[!ve&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Be?"Agent 名称":"名称",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("input",{className:`cw-input ${Ze(Qe)}`,value:De.name,placeholder:"customer_service",onChange:$=>Fe({name:$.target.value})}),L&&nt?l.jsx("span",{className:"cw-error-text",children:nt}):l.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Be?"描述":"智能体描述",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Ze(ct)}`,value:De.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:$=>Fe({description:$.target.value})}),L&&ct?l.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):l.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),_e?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"cw-section-desc",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),De.agentType==="loop"&&l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"最大轮次"}),l.jsx("input",{className:"cw-input",type:"number",min:1,value:De.maxIterations??3,onChange:$=>Fe({maxIterations:Math.max(1,Number($.target.value)||1)})}),l.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):ve?l.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[l.jsxs("div",{className:"cw-remote-center-head",children:[l.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),l.jsx(I0e,{value:((Ea=De.a2aRegistry)==null?void 0:Ea.registrySpaceId)??"",region:((Hi=De.a2aRegistry)==null?void 0:Hi.registryRegion)||ui.region,invalid:L&&oe,onChange:$=>_t(R5,$)}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":xt,"aria-controls":un,onClick:()=>gt($=>!$),children:[l.jsx("span",{children:"更多选项"}),l.jsx(Ms,{className:`cw-more-options-chevron ${xt?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:xt&&l.jsx(Wt.div,{id:un,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:l.jsx(Ml,{env:A0e,values:O5(De.a2aRegistry,{includeDefaults:!1}),onChange:_t})})}),L&&oe&&l.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:["系统提示词",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:l.jsx(k0e,{value:De.instruction,invalid:ot,onChange:$=>Fe({instruction:$})})}),L&&ot?l.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):l.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!_e&&!ve&&l.jsxs(l.Fragment,{children:[l.jsx(Ur,{meta:Ar("model"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"模型名称"}),l.jsx("input",{className:"cw-input",value:De.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:$=>Fe({modelName:$.target.value})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":Ge,"aria-controls":Ct,onClick:()=>Xe($=>!$),children:[l.jsx("span",{children:"更多选项"}),l.jsx(Ms,{className:`cw-more-options-chevron ${Ge?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:Ge&&l.jsxs(Wt.div,{id:Ct,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:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"服务商 Provider"}),l.jsx("input",{className:"cw-input",value:De.modelProvider??"",placeholder:"openai",onChange:$=>Fe({modelProvider:$.target.value})})]}),l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"API Base"}),l.jsx("input",{className:"cw-input",value:De.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:$=>Fe({modelApiBase:$.target.value})}),l.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),l.jsx(Ur,{meta:Ar("tools"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"内置工具"}),l.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),l.jsx("div",{className:"cw-tools-list-shell",children:l.jsx(jC,{items:rl,selected:Bt,onToggle:Mn,scrollRows:6})}),l.jsx(ni,{initial:!1,children:Bt.includes("run_code")&&l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-tool-config-head",children:[l.jsx("span",{className:"cw-label",children:"代码执行配置"}),l.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),l.jsx(Ml,{env:((wl=rl.find($=>$.id==="run_code"))==null?void 0:wl.env)??[],values:((vl=f.deployment)==null?void 0:vl.envValues)??{},onChange:dt})]})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":At,"aria-controls":$t,onClick:()=>ut($=>!$),children:[l.jsx("span",{children:"更多类型工具"}),qt.length>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",qt.length]}),l.jsx(Ms,{className:`cw-more-options-chevron ${At?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:At&&l.jsx(Wt.div,{id:$t,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:l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"MCP 工具"}),l.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),l.jsx(O0e,{tools:qt,onChange:$=>Fe({mcpTools:$})})]})})})]})}),l.jsx(Ur,{meta:Ar("skills"),children:l.jsx("div",{className:"cw-form",children:l.jsx(M0e,{selected:Xt,onChange:$=>Fe({selectedSkills:$})})})}),l.jsx(Ur,{meta:Ar("knowledge"),children:l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ju,{checked:De.knowledgebase,onChange:$=>Fe({knowledgebase:$}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Kp}),De.knowledgebase&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"知识库后端"}),l.jsx(Db,{options:xE,value:De.knowledgebaseBackend,onChange:$=>Fe({knowledgebaseBackend:$,knowledgebaseIndex:$==="viking"?De.knowledgebaseIndex:""})}),(De.knowledgebaseBackend??Fc)==="viking"&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),l.jsx(R0e,{value:De.knowledgebaseIndex??"",onChange:$=>Fe({knowledgebaseIndex:$})})]}),l.jsx(Ml,{env:((xa=xE.find($=>$.id===(De.knowledgebaseBackend??Fc)))==null?void 0:xa.env)??[],values:((wa=f.deployment)==null?void 0:wa.envValues)??{},onChange:dt})]})]})}),Be&&l.jsxs("section",{ref:$=>{qe.current.advanced=$},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[l.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":X,"aria-controls":wn,onClick:()=>ne($=>!$),children:[l.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),l.jsx(Ms,{className:`cw-advanced-disclosure-chevron ${X?"is-open":""}`,"aria-hidden":!0}),Ln>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",Ln]})]}),l.jsx(ni,{initial:!1,children:X&&l.jsxs(Wt.div,{id:wn,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"记忆"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ju,{checked:De.memory.shortTerm,onChange:$=>Fe({memory:{...De.memory,shortTerm:$}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:rM}),De.memory.shortTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"短期记忆后端"}),l.jsx(Db,{options:bE,value:De.shortTermBackend,onChange:$=>Fe({shortTermBackend:$})}),l.jsx(Ml,{env:((va=bE.find($=>$.id===(De.shortTermBackend??"local")))==null?void 0:va.env)??[],values:((mo=f.deployment)==null?void 0:mo.envValues)??{},onChange:dt})]}),l.jsx(Ju,{checked:De.memory.longTerm,onChange:$=>Fe({memory:{...De.memory,longTerm:$}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Kp}),De.memory.longTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"长期记忆后端"}),l.jsx(Db,{options:EE,value:De.longTermBackend,onChange:$=>Fe({longTermBackend:$})}),l.jsx(Ml,{env:((_a=EE.find($=>$.id===(De.longTermBackend??"local")))==null?void 0:_a.env)??[],values:((Vs=f.deployment)==null?void 0:Vs.envValues)??{},onChange:dt}),l.jsx(Ju,{checked:!!De.autoSaveSession,onChange:$=>Fe({autoSaveSession:$}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Kp})]})]})]}),l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"观测"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ju,{checked:De.tracing,onChange:$=>Fe({tracing:$}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:ZL}),De.tracing&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),l.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),l.jsx(jC,{items:wE,selected:vn,onToggle:ue}),l.jsx(Ml,{env:wE.filter($=>vn.includes($.id)).flatMap($=>$.env),values:((vt=f.deployment)==null?void 0:vt.envValues)??{},onChange:dt})]})]})]})]})})]})]})]}),l.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:l.jsxs("ol",{className:"cw-steps",children:[l.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:l.jsx(Wt.div,{className:"cw-rail-fill",animate:{height:`${Math.max(Mt,0)/Math.max(Zt.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),Zt.map($=>{const le=$.id===Ie,Re=or[$.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",className:`cw-step ${le?"is-active":""} ${Re?"is-done":""}`,onClick:()=>Cn($.id),"aria-current":le?"step":void 0,"aria-label":$.label,children:[l.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:le?l.jsx("span",{className:"cw-dot"}):Re?l.jsx(pi,{className:"cw-step-check"}):l.jsx("span",{className:"cw-dot"})}),l.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:$.label})]})},$.id)})]})})]})})}),l.jsx("button",{type:"button",className:"cw-build-next studio-update-action",onClick:Ei,children:l.jsx("span",{children:"开始调试"})})]})]})]}),R==="validate"&&l.jsx("div",{className:"cw-validation-workspace",children:l.jsx("div",{className:"cw-validation-content",children:l.jsx(H0e,{enabled:ie,disabledReason:Q,variants:ee,draftSnapshot:kt,input:me,onInput:Ne,onSend:bs,onStartVariant:Kn,onDeployVariant:$=>void gr($),onAddVariant:yr,onRemoveVariant:es,onToggleConfig:$=>{const le=ee.find(Re=>Re.id===$);le&&Es($,{configOpen:!le.configOpen})},onCompleteConfig:po,onConfigChange:bi})})}),R==="publish"&&l.jsx("div",{className:"cw-preview-body",children:j?l.jsx(U0,{embedded:!0,project:j,agentDraft:f,agentName:f.name||"未命名 Agent",agentCount:j5(f),releaseConfiguration:Ft?{modelName:Ft.modelName||f.modelName||"默认模型",description:Ft.description,instruction:Ft.instruction,optimizations:Ft.optimizations.flatMap($=>{const le=F5.find(Re=>Re.id===$);return le?[le.label]:[]})}:void 0,onChange:U,onDeploy:xs,onAgentAdded:n,onDeploymentTaskChange:i,deploymentActionLabel:a?"更新并发布":"部署",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:c,onDeploymentComplete:o,feishuEnabled:!!((z=f.deployment)!=null&&z.feishuEnabled),onFeishuEnabledChange:$=>{const le={...f,deployment:{...f.deployment??{feishuEnabled:!1},feishuEnabled:$}};h(le)},deploymentEnv:Zn.specs,deploymentEnvValues:{...(re=f.deployment)==null?void 0:re.envValues,...Zn.fixedValues},onDeploymentEnvChange:dt,network:(Ee=f.deployment)==null?void 0:Ee.network,onNetworkChange:$=>h(le=>({...le,deployment:{...le.deployment??{feishuEnabled:!1},network:$}})),deployRegion:W,onDeployRegionChange:B,onExportYaml:()=>N0e(`${f.name||"agent"}.yaml`,Sge(f),"text/yaml")}):l.jsxs("div",{className:"cw-publish-loading",role:"status",children:[l.jsx(Kt,{className:"cw-i cw-spin"}),l.jsx("strong",{children:"正在生成发布配置"}),l.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),F&&l.jsx("div",{className:"confirm-scrim",onClick:()=>q(!1),children:l.jsxs("div",{className:"confirm-box",role:"dialog","aria-modal":"true","aria-labelledby":"discard-edit-title",onClick:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"discard-edit-title",children:"放弃本次编辑?"}),l.jsx("div",{className:"confirm-text",children:"本次修改将不会保留,智能体会恢复到进入编辑前的状态。"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>q(!1),children:"继续编辑"}),l.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",onClick:()=>{q(!1),d==null||d()},children:"放弃编辑"})]})]})}),b&&l.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:l.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:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),l.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:b}),l.jsx("div",{className:"confirm-actions",children:l.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function qi(e){return{...jr(),...e}}const K0e=[{id:"support",icon:wz,draft:qi({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:sz,draft:qi({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:vz,draft:qi({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Qw,draft:qi({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:Cz,draft:qi({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:Hz,draft:qi({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[qi({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),qi({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),qi({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function Y0e(e){const t=[];return e.tools.length&&t.push({icon:lM,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:rz,label:"记忆"}),e.knowledgebase&&t.push({icon:nz,label:"知识库"}),e.tracing&&t.push({icon:ez,label:"观测"}),e.subAgents.length&&t.push({icon:aM,label:`子Agent ${e.subAgents.length}`}),t}function G0e({onBack:e,onCreate:t}){const[n,r]=E.useState(null);return l.jsx("div",{className:"tpl-root",children:n?l.jsx(q0e,{template:n,onBack:()=>r(null),onCreate:t}):l.jsx(W0e,{onPick:r})})}function W0e({onPick:e}){return l.jsxs("div",{className:"tpl-scroll",children:[l.jsxs("div",{className:"tpl-head",children:[l.jsx("h1",{className:"tpl-title",children:"从模板新建"}),l.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),l.jsx("div",{className:"tpl-grid",children:K0e.map((t,n)=>l.jsxs(Wt.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:[l.jsx("span",{className:"tpl-card-icon",children:l.jsx(t.icon,{className:"icon"})}),l.jsx("span",{className:"tpl-card-name",children:t.draft.name}),l.jsx("span",{className:"tpl-card-desc",children:Hs(t.draft.description)})]},t.id))})]})}function q0e({template:e,onBack:t,onCreate:n}){const[r,s]=E.useState(e.draft.name),i=e.icon,a=Y0e(e.draft);function o(){const c=r.trim()||e.draft.name;n({...e.draft,name:c})}return l.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[l.jsxs("button",{className:"tpl-back",onClick:t,children:[l.jsx(qw,{className:"icon"})," 返回模板列表"]}),l.jsxs(Wt.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[l.jsxs("div",{className:"tpl-detail-head",children:[l.jsx("span",{className:"tpl-detail-icon",children:l.jsx(i,{className:"icon"})}),l.jsxs("div",{className:"tpl-detail-headtext",children:[l.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),l.jsx("div",{className:"tpl-detail-desc",children:Hs(e.draft.description)})]})]}),a.length>0&&l.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>l.jsxs("span",{className:"tpl-tag",children:[l.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),l.jsxs("label",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"名称"}),l.jsx("input",{className:"tpl-input",value:r,onChange:c=>s(c.target.value),placeholder:e.draft.name})]}),l.jsxs("div",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),l.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),l.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"模型"}),l.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"工具"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"记忆"}),l.jsx("span",{className:"tpl-meta-val",children:X0e(e.draft)})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"知识库"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&l.jsxs("div",{className:"tpl-field",children:[l.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),l.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>l.jsxs("div",{className:"tpl-subagent",children:[l.jsxs("div",{className:"tpl-subagent-top",children:[l.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&l.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),l.jsx("div",{className:"tpl-subagent-desc",children:Hs(c.description)})]},u))})]}),l.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",l.jsx(Ms,{className:"icon"})]})]})]})}function X0e(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const Q0e=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:sM},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:GL},{type:"loop",label:"循环",desc:"节点循环执行",Icon:nv}];let bx=0;function $b(){return bx+=1,`node_${bx}`}function Hb(e,t,n){const r=jr();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function Z0e({data:e,selected:t}){const n=e.agent;return l.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[l.jsx(kr,{type:"target",position:Ue.Left,className:"wfb-handle"}),l.jsx("div",{className:"wfb-node-icon",children:l.jsx(tl,{className:"icon"})}),l.jsxs("div",{className:"wfb-node-body",children:[l.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),l.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),l.jsx(kr,{type:"source",position:Ue.Right,className:"wfb-handle"})]})}const J0e={agentNode:Z0e},BC={type:"smoothstep",markerEnd:{type:Wc.ArrowClosed,width:16,height:16}};function eye({onBack:e,onCreate:t}){const n=E.useRef(null),[r,s]=E.useState(""),[i,a]=E.useState(""),[o,c]=E.useState("sequential"),u=E.useMemo(()=>{bx=0;const T=$b();return Hb(T,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=C4([u]),[p,m,g]=I4([]),[x,y]=E.useState(u.id),w=d.find(T=>T.id===x)??null,b=r.trim()||"workflow_agent",_=E.useMemo(()=>_5({name:b,subAgents:d.map(T=>T.data.agent)}),[b,d]),k=Nc(b)??(_.has(b)?"名称须与 Agent 节点名称保持唯一":null),N=w?Nc(w.data.agent.name)??(_.has(w.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,A=d.length>0&&k===null&&d.every(T=>Nc(T.data.agent.name)===null&&!_.has(T.data.agent.name)),S=E.useCallback(T=>m(M=>r4({...T,...BC},M)),[m]),C=E.useCallback(()=>{const T=$b(),M=d.length*28,j=Hb(T,{x:80+M,y:120+M});f(U=>U.concat(j)),y(T)},[d.length,f]),R=T=>{T.dataTransfer.setData("application/wfb-node","agentNode"),T.dataTransfer.effectAllowed="move"},O=E.useCallback(T=>{T.preventDefault(),T.dataTransfer.dropEffect="move"},[]),F=E.useCallback(T=>{if(T.preventDefault(),T.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const j=n.current.screenToFlowPosition({x:T.clientX,y:T.clientY}),U=$b(),I=Hb(U,j);f(K=>K.concat(I)),y(U)},[f]),q=E.useCallback(T=>{x&&f(M=>M.map(j=>j.id===x?{...j,data:{...j.data,agent:{...j.data.agent,...T}}}:j))},[x,f]),L=E.useCallback(()=>{x&&(f(T=>T.filter(M=>M.id!==x)),m(T=>T.filter(M=>M.source!==x&&M.target!==x)),y(null))},[x,f,m]),D=E.useCallback(()=>{if(!A)return;const T=d.map(j=>j.data.agent),M={...jr(),name:b,description:i.trim(),instruction:i.trim(),subAgents:T,workflow:{type:o,nodes:d.map(j=>({id:j.id,agent:j.data.agent})),edges:p.map(j=>({from:j.source,to:j.target}))}};t(M)},[A,d,p,b,i,o,t]);return l.jsx("div",{className:"wfb",children:l.jsxs("div",{className:"wfb-grid",children:[l.jsxs("aside",{className:"wfb-palette",children:[l.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:T=>s(T.target.value),placeholder:"my_workflow"}),k&&l.jsx("span",{className:"wfb-field-error",children:k})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:i,onChange:T=>a(T.target.value),placeholder:"这个工作流做什么…",rows:2})]}),l.jsx("div",{className:"wfb-section-label",children:"执行方式"}),l.jsx("div",{className:"wfb-types",children:Q0e.map(({type:T,label:M,desc:j,Icon:U})=>l.jsxs("button",{type:"button",className:`wfb-type ${o===T?"wfb-type--active":""}`,onClick:()=>c(T),children:[l.jsx(U,{className:"icon"}),l.jsxs("span",{className:"wfb-type-text",children:[l.jsx("span",{className:"wfb-type-name",children:M}),l.jsx("span",{className:"wfb-type-desc",children:j})]})]},T))}),l.jsx("div",{className:"wfb-section-label",children:"节点"}),l.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:R,title:"拖拽到画布,或点击下方按钮添加",children:[l.jsx(xz,{className:"icon wfb-grip"}),l.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:l.jsx(tl,{className:"icon"})}),l.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),l.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[l.jsx(ir,{className:"icon"}),"添加节点"]}),l.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),l.jsxs("div",{className:"wfb-canvas",children:[l.jsxs("button",{className:"wfb-create",onClick:D,disabled:!A,type:"button",children:[l.jsx(nl,{className:"icon"}),"创建工作流"]}),l.jsxs(A4,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:g,onConnect:S,onInit:T=>n.current=T,nodeTypes:J0e,defaultEdgeOptions:BC,onDrop:F,onDragOver:O,onNodeClick:(T,M)=>y(M.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[l.jsx(O4,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),l.jsx(M4,{showInteractive:!1}),l.jsx(Ede,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),l.jsx("aside",{className:"wfb-inspector",children:w?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"wfb-inspector-head",children:[l.jsx("div",{className:"wfb-section-label",children:"节点配置"}),l.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:L,title:"删除节点",children:l.jsx(js,{className:"icon"})})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${N?"wfb-input--error":""}`,value:w.data.agent.name,onChange:T=>q({name:T.target.value}),placeholder:"agent_name"}),N?l.jsx("span",{className:"wfb-field-error",children:N}):l.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("input",{className:"wfb-input",value:w.data.agent.description,onChange:T=>q({description:T.target.value}),placeholder:"这个 agent 做什么…"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:w.data.agent.instruction,onChange:T=>q({instruction:T.target.value}),placeholder:"你是一个…",rows:6})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),l.jsx("input",{className:"wfb-input",value:w.data.agent.tools.join(", "),onChange:T=>q({tools:T.target.value.split(",").map(M=>M.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),l.jsxs("div",{className:"wfb-inspector-meta",children:[l.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),l.jsx("code",{className:"wfb-meta-val",children:w.id})]})]}):l.jsxs("div",{className:"wfb-inspector-empty",children:[l.jsx(tl,{className:"wfb-empty-icon"}),l.jsx("p",{children:"选择一个节点以编辑其配置"}),l.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function tye(e){return l.jsx(c_,{children:l.jsx(eye,{...e})})}const FC=50*1024*1024,Ex=800,nye={name:"code_package",files:[]};function rye(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 sye(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(r=>!r||r==="."||r===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function iye(e){const t=e.flatMap(a=>{const o=sye(a.name);return o?[{path:o,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>Ex)throw new Error(`代码包文件数不能超过 ${Ex} 个。`);const s=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,i=new Set;for(const a of s){if(i.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);i.add(a.path)}if(!i.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return s}function aye({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n}){const r=E.useRef(null),s=E.useRef(0),[i,a]=E.useState(null),[o,c]=E.useState(""),[u,d]=E.useState(!1),[f,h]=E.useState(!1),[p,m]=E.useState(!1),[g,x]=E.useState(""),[y,w]=E.useState("cn-beijing"),[b,_]=E.useState();E.useEffect(()=>()=>{s.current+=1},[]);async function k(C){const R=++s.current;if(x(""),!C.name.toLowerCase().endsWith(".zip")){x("请选择 .zip 格式的代码包。");return}if(C.size>FC){x("代码包不能超过 50 MB。");return}h(!0);try{const O=await N5(new Uint8Array(await C.arrayBuffer()),{maxEntries:Ex,maxUncompressedBytes:FC}),F=iye(O);if(R!==s.current)return;c(C.name),a({name:rye(C.name),files:F})}catch(O){if(R!==s.current)return;c(""),a(null),x(O instanceof Error?O.message:String(O))}finally{R===s.current&&h(!1)}}function N(C){var O;const R=(O=C.currentTarget.files)==null?void 0:O[0];C.currentTarget.value="",R&&k(R)}function A(C){var O;C.preventDefault(),m(!1);const R=(O=C.dataTransfer.files)==null?void 0:O[0];R&&k(R)}async function S(C,R,O){const F=b&&b.mode!=="public"?{mode:b.mode,vpc_id:b.vpcId,subnet_ids:b.subnetIds,enable_shared_internet_access:b.enableSharedInternetAccess}:void 0;return t0(C.name,C.files,{region:y,projectName:"default",network:F},{...O,onStage:R})}return l.jsxs("div",{className:"package-create package-create-preview",children:[l.jsx(U0,{project:i??nye,agentName:(i==null?void 0:i.name)||"代码包",onChange:i?a:void 0,onDeploy:S,onAgentAdded:t,onDeploymentTaskChange:n,network:b,onNetworkChange:_,deployRegion:y,onDeployRegionChange:w,onBack:e,backLabel:"返回创建方式",deployDisabled:!i||f,deployDisabledReason:f?"正在读取代码包":i?void 0:"请先上传代码包",deploymentPrimaryPane:l.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[l.jsx("div",{className:"package-source-label",children:"代码包"}),l.jsxs("div",{className:`package-dropzone${p?" is-dragging":""}${i?" is-ready":""}`,onDragEnter:C=>{C.preventDefault(),m(!0)},onDragOver:C=>C.preventDefault(),onDragLeave:C=>{C.currentTarget.contains(C.relatedTarget)||m(!1)},onDrop:A,onClick:()=>{var C;f||(C=r.current)==null||C.click()},onKeyDown:C=>{var R;!f&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),(R=r.current)==null||R.click())},role:"button",tabIndex:f?-1:0,"aria-label":i?"重新上传代码包":"上传代码包","aria-disabled":f,children:[l.jsx("strong",{children:f?"正在读取代码包…":i?o:"请上传代码包"}),l.jsx("span",{children:i?`已识别 ${i.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),l.jsx("div",{className:"package-upload-actions",children:i&&l.jsx("button",{type:"button",className:"package-upload-secondary",onClick:C=>{C.stopPropagation(),d(!0)},onKeyDown:C=>C.stopPropagation(),children:"查看文件"})}),l.jsx("input",{ref:r,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:N})]}),g&&l.jsx("div",{className:"package-create-error",role:"alert",children:g})]})}),i&&l.jsx(v5,{project:i,open:u,onClose:()=>d(!1),onChange:a})]})}const oye=3*60*1e3,lye=3e3,cye=10*60*1e3,kg="veadk.studio.pending-update",UC=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],uye={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function dye(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function fye(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function hye(){if(typeof window>"u")return null;const e=window.localStorage.getItem(kg);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(kg),null}function zb(e,t){window.localStorage.setItem(kg,JSON.stringify({targetVersion:e,startedAt:t}))}function Ap(){window.localStorage.removeItem(kg)}function $C({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),l.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),l.jsx("path",{d:"M12 7.8v7.7"}),l.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function pye(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m4 6 4 4 4-4"})})}function mye(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function HC({lines:e,phase:t,copyState:n,onCopy:r}){const s=E.useRef(null),i=E.useRef(!0);return E.useEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[e]),l.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[l.jsxs("div",{className:"studio-update-log-header",children:[l.jsxs("span",{children:[l.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",l.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),l.jsx("button",{type:"button",onClick:r,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),l.jsx("div",{ref:s,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const o=a.currentTarget;i.current=o.scrollHeight-o.scrollTop-o.clientHeight<24},children:e.length?e.map((a,o)=>l.jsx("div",{children:a},`${o}-${a}`)):l.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function gye(){var q,L;const[e]=E.useState(hye),[t,n]=E.useState(null),[r,s]=E.useState(e?"submitting":"idle"),[i,a]=E.useState(!1),[o,c]=E.useState(""),[u,d]=E.useState((e==null?void 0:e.targetVersion)??""),[f,h]=E.useState(!1),[p,m]=E.useState("idle"),[g,x]=E.useState(0),y=E.useRef(null),w=E.useRef((e==null?void 0:e.targetVersion)??""),b=E.useRef((e==null?void 0:e.startedAt)??0);E.useEffect(()=>{if(!f)return;const D=M=>{var j;M.target instanceof Node&&!((j=y.current)!=null&&j.contains(M.target))&&h(!1)},T=M=>{M.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",D),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",D),window.removeEventListener("keydown",T)}},[f]);const _=E.useCallback(async()=>{const D=await jM(w.current||void 0,b.current||void 0);return n(D),D},[]);if(E.useEffect(()=>{let D=!0;const T=()=>{_().catch(()=>{D&&n(j=>j)})};T();const M=window.setInterval(T,oye);return()=>{D=!1,window.clearInterval(M)}},[_]),E.useEffect(()=>{if(r!=="submitting")return;const D=window.setInterval(()=>{_().then(T=>{const M=w.current;if(M&&fye(T.currentVersion,M)||!M&&!T.available&&T.latestVersion){window.clearInterval(D),Ap(),s("published"),c("Studio 已更新,刷新页面即可使用新版本");return}if(T.state==="error"){window.clearInterval(D),Ap(),s("error"),c(T.message||"Studio 更新失败");return}Date.now()-b.current>cye&&(window.clearInterval(D),Ap(),s("error"),c("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},lye);return()=>window.clearInterval(D)},[r,_]),E.useEffect(()=>{r!=="idle"||(t==null?void 0:t.state)!=="updating"||(w.current=t.targetVersion,b.current=t.startedAt||Date.now(),zb(t.targetVersion,b.current),d(t.targetVersion),s("submitting"))},[r,t]),E.useEffect(()=>{if(r!=="submitting"){x(0);return}const D=()=>{const M=b.current||Date.now();x(Math.max(0,Math.floor((Date.now()-M)/1e3)))};D();const T=window.setInterval(D,1e3);return()=>window.clearInterval(T)},[r]),!(t!=null&&t.enabled)||!(t.available||t.state==="updating"||r!=="idle"))return null;const N=t.releases??[],A=u||((q=N[0])==null?void 0:q.version)||t.latestVersion,S=N.find(D=>D.version===A),C=async()=>{w.current=A,b.current=Date.now(),zb(A,b.current),s("submitting"),c(""),m("idle");try{const D=await DM(A);w.current=D.version,zb(D.version,b.current),c("更新已提交,正在等待 VeFaaS 发布新版本")}catch(D){if(D instanceof TypeError){c("连接已切换,正在确认新版本状态");return}Ap(),s("error");const T=D instanceof Error?D.message:"Studio 更新失败";try{const M=await _();c(M.message||T)}catch{c(T)}}},R=(L=t.updateLogs)!=null&&L.length?t.updateLogs:(t.errorLog||t.progressMessage||o).split(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let s=1;s=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function d0e(...e){var t;for(const n of e){const r=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(r)return r.slice(0,64)}return"local-skill"}function f0e(e,t){return t.trim()||e}function S5(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(s=>({path:s.path.slice(r.length),text:s.text}))}return t}function h0e(e){const t=new Map,n=new Set;for(const r of e)if(gx.test("/"+r.path)){const s=r.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const r of e){const s=r.path.split("/");let i="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){i=d;break}}const a=gx.test("/"+r.path);if(!i&&!a&&!n.has("")||!n.has(i)&&!a)continue;const o=i?r.path.slice(i.length+1):r.path,c=t.get(i)||[];c.push({path:o,text:r.text}),t.set(i,c)}return t}function p0e(e,t,n){const r=`${n}${e?"/"+e:""}`,s=t.find(c=>gx.test("/"+c.path));if(!s)return{hit:null,error:`${r} 缺少 SKILL.md`};const i=c0e(s.text),a=d0e(i.name,e,n.replace(/\.[^.]+$/,"")),o=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${c.path}`};o.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:f0e(a,i.name),description:i.description||"本地 Skill",folder:a,localFiles:o},error:null}}async function m0e(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await N5(t)).map(s=>({path:s.name,text:s.text}));return T5(S5(r),e.name)}async function g0e(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function b0e(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((s,i)=>t.readEntries(s,i));if(r.length===0)return n;n.push(...r)}}async function A5(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await y0e(e),path:n}];if(!e.isDirectory)return[];const r=await b0e(e);return(await Promise.all(r.map(s=>A5(s,n)))).flat()}function E0e({selected:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState([]),[a,o]=E.useState(!1),[c,u]=E.useState(!1),d=E.useRef(0),f=b=>e.some(_=>_.source==="local"&&_.folder===b),h=b=>{b.localFiles&&(f(b.folder||b.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(b.folder||b.name)))):t([...e,{source:"local",folder:b.folder||b.name,name:b.name,description:b.description,localFiles:b.localFiles}]))},p=E.useRef([]),m=E.useRef(e);E.useEffect(()=>{p.current=s},[s]),E.useEffect(()=>{m.current=e},[e]);const g=b=>{const _=new Set([...p.current.map(S=>S.folder||S.name),...m.current.filter(S=>S.source==="local").map(S=>S.folder)]),k=[],N=[];for(const S of b.hits){const C=S.folder||S.name;if(_.has(C)){k.push(S.name);continue}_.add(C),N.push(S)}i(S=>[...S,...N]);const A=[...b.errors];if(k.length>0&&A.push(`已跳过重复技能:${k.join("、")}`),r(A),N.length===1&&b.errors.length===0&&k.length===0){const S=N[0];S.localFiles&&t([...m.current,{source:"local",folder:S.folder||S.name,name:S.name,description:S.description,localFiles:S.localFiles}])}},x=b=>{b.preventDefault(),d.current+=1,u(!0)},y=b=>{b.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},w=async b=>{if(b.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(b.dataTransfer.items).map(k=>{var N;return(N=k.webkitGetAsEntry)==null?void 0:N.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(S=>A5(S)))).flat(),N=_.some(S=>S.isDirectory);if(!N&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){g(await m0e(k[0].file));return}if(!N){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const A=new Map(k.map(({file:S,path:C})=>[S,C]));g(await g0e(k.map(({file:S})=>S),A))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return l.jsxs("div",{className:"cw-local",children:[l.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:x,onDragOver:b=>b.preventDefault(),onDragLeave:y,onDrop:b=>void w(b),children:[l.jsx(tv,{className:"cw-local-drop-icon","aria-hidden":!0}),l.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),l.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&l.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:n.join(";")})]}),s.length>0&&l.jsx("div",{className:"cw-skill-results",children:s.map(b=>{var k;const _=f(b.folder||b.name);return l.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(b),"aria-pressed":_,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(b.description)}),l.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=b.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},b.id)})})]})}function x0e({selected:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState([]),[a,o]=E.useState(""),[c,u]=E.useState(!0),[d,f]=E.useState(!1),[h,p]=E.useState(null);E.useEffect(()=>{let y=!1;return(async()=>{u(!0),p(null);try{const w=await JM();y||(r(w),w.length>0&&o(w[0].id))}catch(w){y||p(w instanceof Error?w.message:"加载失败")}finally{y||u(!1)}})(),()=>{y=!0}},[]),E.useEffect(()=>{if(!a){i([]);return}const y=n.find(b=>b.id===a);let w=!1;return(async()=>{f(!0),p(null);try{const b=await e3(a,y==null?void 0:y.region);w||i(b)}catch(b){w||p(b instanceof Error?b.message:"加载失败")}finally{w||f(!1)}})(),()=>{w=!0}},[a,n]);const m=n.find(y=>y.id===a),g=(y,w)=>e.some(b=>b.source==="skillspace"&&b.skillId===y&&(b.version||"")===w),x=y=>{if(m)if(g(y.skillId,y.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===y.skillId&&(w.version||"")===y.version)));else{const w=cK(m,y);t([...e,{source:"skillspace",folder:w.folder||y.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return l.jsx("div",{className:"cw-skillspace",children:c?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Kt,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?l.jsxs("div",{className:"cw-banner",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:h})]}):n.length===0?l.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-skillspace-header",children:[l.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:y=>o(y.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(y=>l.jsxs("option",{value:y.id,children:[y.name||y.id,y.region?` [${y.region}]`:"",y.description?` — ${Hs(y.description)}`:""]},y.id))}),m&&l.jsx("a",{href:uK(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:l.jsx(ev,{className:"cw-i cw-i-sm"})})]}),d?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Kt,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?l.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):l.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const w=g(y.skillId,y.version);return l.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>x(y),"aria-pressed":w,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?l.jsx(pi,{className:"cw-i cw-i-sm"}):l.jsx(ir,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsxs("span",{className:"cw-skill-result-name",children:[y.skillName,y.version&&l.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",y.version]})]}),y.skillDescription&&l.jsx("span",{className:"cw-skill-result-desc",children:Hs(y.skillDescription)}),l.jsxs("span",{className:"cw-skill-result-repo",children:[l.jsx(az,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${y.skillId}/${y.version}`)})})]})})}async function w0e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,cu)});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 v0e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await w0e(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function _0e(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:ci(void 0,cu)});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 k0e(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await _0e(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const N0e=E.lazy(()=>Nc(()=>import("./MarkdownPromptEditor-DlOTcMR-.js"),__vite__mapDeps([0,1])));function S0e(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r)}const OC=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:Bz,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:uo,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:lz},{id:"tools",label:"工具",hint:"可调用的能力",icon:lM},{id:"skills",label:"技能",hint:"声明式技能",icon:nl},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:Kp},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:rM},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:XL},{id:"review",label:"完成",hint:"预览并创建",icon:jz}];function T0e({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),l.jsx("path",{d:"M3 10v4",opacity:"0.45"}),l.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function C5({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7 9 5 5 5-5"})})}function I5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),l.jsx("path",{d:"M4.5 4.75v3.5H8"}),l.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),l.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const A0e={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},LC={llm:"理解任务并完成一个具体工作",sequential:"内部步骤按照顺序依次执行",parallel:"内部步骤同时工作,完成后统一汇总",loop:"重复执行内部步骤,直到满足停止条件",a2a:"调用已经存在的远程 Agent"},MC={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},R5="REGISTRY_SPACE_ID",C0e=t3.filter(e=>e.key!==R5);function O5(e,t){var r,s,i;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||ui.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||ui.region,n.REGISTRY_ENDPOINT=((i=e.registryEndpoint)==null?void 0:i.trim())||ui.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function jC({items:e,selected:t,onToggle:n,scrollRows:r}){return l.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(s=>{const i=t.includes(s.id);return l.jsxs("button",{type:"button",className:`cw-check ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:[l.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:i&&l.jsx(pi,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-check-text",children:[l.jsx("span",{className:"cw-check-title",children:s.label}),l.jsx("span",{className:"cw-check-desc",children:Hs(s.desc)})]})]},s.id)})})}function Db({options:e,value:t,onChange:n}){return l.jsx("div",{className:"cw-segmented",children:e.map(r=>{var i;const s=(t??((i=e[0])==null?void 0:i.id))===r.id;return l.jsxs("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":s,title:Hs(r.desc),children:[l.jsx("span",{className:"cw-seg-title",children:r.label}),l.jsx("span",{className:"cw-seg-desc",children:Hs(r.desc)})]},r.id)})})}function I0e(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function Ml({env:e,values:t,onChange:n}){return e.length===0?l.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):l.jsx("div",{className:"cw-env-fields",children:e.map(r=>l.jsxs("label",{className:"cw-env-field",children:[l.jsxs("span",{className:"cw-env-field-head",children:[l.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&l.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&l.jsx("code",{title:r.key,children:r.key})]}),l.jsx("input",{className:"cw-input",type:I0e(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:s=>n(r.key,s.currentTarget.value)})]},r.key))})}function Pb(e){return e.name.trim()||"未命名智能体中心"}function Bb(e){return e.name.trim()||e.id||"未命名知识库"}function R0e({value:e,region:t,invalid:n,onChange:r}){const s=t.trim()||ui.region,[i,a]=E.useState([]),[o,c]=E.useState(!1),[u,d]=E.useState(null),[f,h]=E.useState(0),[p,m]=E.useState(!1),[g,x]=E.useState(""),y=E.useRef(null);E.useEffect(()=>{let C=!1;return c(!0),d(null),v0e({region:s}).then(R=>{C||a(R)}).catch(R=>{C||(a([]),d(R instanceof Error?R.message:"加载失败"))}).finally(()=>{C||c(!1)}),()=>{C=!0}},[s,f]);const w=!e||i.some(C=>C.id===e.trim()),b=i.find(C=>C.id===e.trim()),_=b?Pb(b):e&&!w?"已选择的智能体中心":"请选择智能体中心",k=o&&i.length===0,N=E.useMemo(()=>i.filter(C=>vg(g,[Pb(C),C.id,C.projectName])),[g,i]),A=!!(e&&!w&&vg(g,["已选择的智能体中心",e]));E.useEffect(()=>{if(!p)return;const C=O=>{const F=O.target;F instanceof Node&&y.current&&!y.current.contains(F)&&m(!1)},R=O=>{O.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",C),window.addEventListener("keydown",R),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",R)}},[p]);const S=C=>{r(C),m(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker",ref:y,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:k,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{x(""),m(C=>!C)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:_}),l.jsx(C5,{className:"cw-a2a-space-trigger-icon"})]}),p&&l.jsxs("div",{className:"cw-a2a-space-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:g,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:C=>x(C.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[A&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S(e),children:"已选择的智能体中心"}),N.map(C=>{const R=Pb(C),O=C.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":O,className:`cw-a2a-space-option ${O?"is-selected":""}`,title:`${R} (${C.id})`,onClick:()=>S(C.id),children:R},C.id)}),!A&&N.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:o,onClick:()=>h(C=>C+1),children:o?l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(I5,{className:"cw-i cw-i-sm"})})]}),u?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:u})]}):o?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):i.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",i.length," 个智能体中心,列表仅展示中心名称。"]})]})}function O0e({value:e,onChange:t}){const[n,r]=E.useState([]),[s,i]=E.useState(!1),[a,o]=E.useState(null),[c,u]=E.useState(0),[d,f]=E.useState(!1),[h,p]=E.useState(""),m=E.useRef(null);E.useEffect(()=>{let N=!1;return i(!0),o(null),k0e().then(A=>{N||r(A)}).catch(A=>{N||(r([]),o(A instanceof Error?A.message:"加载失败"))}).finally(()=>{N||i(!1)}),()=>{N=!0}},[c]);const g=!e||n.some(N=>N.id===e.trim()),x=n.find(N=>N.id===e.trim()),y=x?Bb(x):e&&!g?e:"请选择 VikingDB 知识库",w=s&&n.length===0,b=E.useMemo(()=>n.filter(N=>vg(h,[Bb(N),N.id,N.description,N.projectName])),[n,h]),_=!!(e&&!g&&vg(h,[e]));E.useEffect(()=>{if(!d)return;const N=S=>{const C=S.target;C instanceof Node&&m.current&&!m.current.contains(C)&&f(!1)},A=S=>{S.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",N),window.addEventListener("keydown",A),()=>{window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",A)}},[d]);const k=N=>{t(N),f(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:w,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(N=>!N)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:y}),l.jsx(C5,{className:"cw-a2a-space-trigger-icon"})]}),d&&l.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:N=>p(N.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[_&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:e}),b.map(N=>{const A=Bb(N),S=N.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":S,className:`cw-a2a-space-option ${S?"is-selected":""}`,title:`${A} (${N.id})`,onClick:()=>k(N.id),children:A},N.id)}),!_&&b.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:s,onClick:()=>u(N=>N+1),children:s?l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(I5,{className:"cw-i cw-i-sm"})})]}),a?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(uo,{className:"cw-i"}),l.jsx("span",{children:a})]}):s?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Kt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 VikingDB 知识库…"]}):n.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function L0e({tools:e,onChange:t}){const n=(i,a)=>t(e.map((o,c)=>c===i?{...o,...a}:o)),r=i=>t(e.filter((a,o)=>o!==i)),s=()=>t([...e,{name:"",transport:"http",url:""}]);return l.jsxs("div",{className:"cw-mcp",children:[e.length>0&&l.jsx("div",{className:"cw-mcp-list",children:l.jsx(ni,{initial:!1,children:e.map((i,a)=>l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-mcp-rowhead",children:[l.jsxs("div",{className:"cw-mcp-transport",children:[l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":i.transport==="http",children:l.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":i.transport==="stdio",children:l.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:l.jsx(js,{className:"cw-i cw-i-sm"})})]}),l.jsx("input",{className:"cw-input",value:i.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),i.transport==="http"?l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),l.jsx("input",{className:"cw-input",value:i.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),l.jsx("input",{className:"cw-input",value:(i.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),l.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),l.jsxs("button",{type:"button",className:"cw-add-sub",onClick:s,children:[l.jsx(ir,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&l.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function L5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.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"}),l.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),l.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"}),l.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function M0e({s:e,onRemove:t}){let n=nl,r="火山 Find Skill 技能广场";return e.source==="local"?(n=tv,r="本地"):e.source==="skillspace"&&(n=L5,r="AgentKit Skills 中心"),l.jsxs(Wt.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:[l.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:l.jsx(n,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-selected-skill-meta",children:[l.jsx("span",{className:"cw-selected-skill-name",children:e.name}),l.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${Hs(e.description)}`:""]})]}),l.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:l.jsx(Zr,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const Fb=[{id:"local",label:"本地文件",icon:tv},{id:"skillspace",label:"AgentKit Skills 中心",icon:L5},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Xg}];function j0e({selected:e,onChange:t}){const[n,r]=E.useState("local"),[s,i]=E.useState(!1),a=Fb.findIndex(c=>c.id===n),o=c=>t(e.filter(u=>Ub(u)!==c));return E.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&i(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),l.jsxs("div",{className:"cw-skillspane",children:[l.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>i(!0),children:[l.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:l.jsx(ir,{className:"cw-i"})}),l.jsx("span",{children:"添加 Skill"})]}),e.length>0&&l.jsxs("div",{className:"cw-skill-selected",children:[l.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),l.jsx("div",{className:"cw-selected-skill-list",children:l.jsx(ni,{initial:!1,children:e.map(c=>l.jsx(M0e,{s:c,onRemove:()=>o(Ub(c))},Ub(c)))})})]}),l.jsx(ni,{children:s&&l.jsx(Wt.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&i(!1)},children:l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-skill-dialog-head",children:[l.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),l.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>i(!1),children:l.jsx(Zr,{className:"cw-i"})})]}),l.jsxs("div",{className:"cw-skill-dialog-body",children:[l.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${Fb.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[l.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),Fb.map(({id:c,label:u,icon:d})=>l.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:()=>r(c),children:[l.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),l.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&l.jsx(l0e,{selected:e,onChange:t}),n==="local"&&l.jsx(E0e,{selected:e,onChange:t}),n==="skillspace"&&l.jsx(x0e,{selected:e,onChange:t})]})]})]})})})]})}function Ub(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function ed({checked:e,onChange:t,title:n,desc:r,icon:s}){return l.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[l.jsx("span",{className:"cw-toggle-icon",children:l.jsx(s,{className:"cw-i"})}),l.jsxs("span",{className:"cw-toggle-text",children:[l.jsx("span",{className:"cw-toggle-title",children:n}),l.jsx("span",{className:"cw-toggle-desc",children:Hs(r)})]}),l.jsx("span",{className:"cw-switch","aria-hidden":!0,children:l.jsx(Wt.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function D0e(e,t){var r;let n=e;for(const s of t)if(n=(r=n.subAgents)==null?void 0:r[s],!n)return!1;return!0}function Tp(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function bh(e,t,n){if(t.length===0)return n(e);const[r,...s]=t,i=e.subAgents.slice();return i[r]=bh(i[r],s,n),{...e,subAgents:i}}function P0e(e,t){return bh(e,t,n=>({...n,subAgents:[...n.subAgents,jr()]}))}function B0e(e,t,n){return bh(e,t,r=>{const s=r.subAgents.slice();return s.splice(n,0,jr()),{...r,subAgents:s}})}function F0e(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return bh(e,n,s=>({...s,subAgents:s.subAgents.filter((i,a)=>a!==r)}))}const yx=e=>!$0(e.agentType),DC=3;function U0e(e,t,n=!1){var s;if($0(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const r=Sc(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":k5(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function M5(e,t,n=[]){const r=[],s=$0(e.agentType),i=U0e(e,t,n.length===0);return i&&r.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",problem:i}),yx(e)&&e.subAgents.forEach((a,o)=>r.push(...M5(a,t,[...n,o]))),r}function j5(e){return 1+e.subAgents.reduce((t,n)=>t+j5(n),0)}function D5(e){const t=[],n={},r=i=>{var a,o,c,u;for(const d of i.builtinTools??[]){const f=rl.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=i.a2aRegistry)!=null&&a.enabled&&(t.push({env:t3}),Object.assign(n,O5(i.a2aRegistry,{includeDefaults:!0}))),i.memory.shortTerm&&t.push({env:((o=bE.find(d=>d.id===(i.shortTermBackend??"local")))==null?void 0:o.env)??[]}),i.memory.longTerm&&t.push({env:((c=EE.find(d=>d.id===(i.longTermBackend??"local")))==null?void 0:c.env)??[]}),i.knowledgebase&&t.push({env:((u=xE.find(d=>d.id===(i.knowledgebaseBackend??Uc)))==null?void 0:u.env)??[]}),i.tracing)for(const d of i.tracingExporters??[]){const f=wE.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}i.subAgents.forEach(r)};r(e);const s=x5(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function P5(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function $0e(e){var n;const t=e.name.trim();return t||(e.agentType!=="sequential"?"":((n=e.subAgents.find(r=>r.name.trim()))==null?void 0:n.name.trim())??"")}function B5(e){var r,s;const t=D5(e),n={...((r=e.deployment)==null?void 0:r.envValues)??{},...t.fixedValues};return{...P5(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(w5(t.specs,n).map(({key:i,value:a})=>[i,a]))}}}function H0e(e){return JSON.stringify(B5(e))}function _g(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function cc(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function z0e({enabled:e,disabledReason:t,variants:n,draftSnapshot:r,input:s,onInput:i,onSend:a,onStartVariant:o,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p}){const m=n.filter(y=>y.phase!=="ready"?!1:y.runtimeSnapshot===_g(r,y)),g=n.some(y=>y.phase==="sending"),x=m.length>0&&!g;return l.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[l.jsx("div",{className:"cw-ab-stage",children:e?l.jsxs("div",{className:"cw-ab-grid",children:[n.map((y,w)=>{const b=y.modelName.trim(),_=y.description.trim(),k=y.instruction.trim(),N=cc(y),A=!!(b&&_&&k&&n.findIndex(T=>cc(T)===N)!==w),S=!b||!_||!k||A,C=!!(y.runtimeSnapshot&&y.runtimeSnapshot!==_g(r,y)),R=y.phase==="starting",O=y.phase==="ready"&&!C,F=R||y.phase==="sending",q=F||y.configOpen||S,L=b?_?k?A?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",D=R?"正在启动":C?"应用配置并重启":O||y.phase==="error"?"重新启动环境":"启动环境";return l.jsx("article",{className:"cw-ab-card",children:l.jsxs("div",{className:`cw-ab-card-inner${y.configOpen?" is-flipped":""}`,children:[l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":y.configOpen,children:[l.jsxs("header",{className:"cw-ab-card-head",children:[l.jsxs("div",{className:"cw-ab-card-title",children:[l.jsx("strong",{children:y.name}),l.jsx("span",{children:y.modelName||"默认模型"})]}),l.jsxs("div",{className:"cw-ab-card-actions",children:[l.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:y.configOpen||F,onClick:()=>f(y.id),children:"测试配置"}),y.id!=="baseline"&&l.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${y.name}`,disabled:y.configOpen||F,onClick:()=>d(y.id),children:l.jsx(js,{className:"cw-i"})})]})]}),l.jsx("div",{className:"cw-ab-conversation",children:y.error?l.jsx(wg,{message:y.error,className:"cw-debug-error-detail"}):R?l.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[l.jsx(Kt,{className:"cw-i cw-spin"}),l.jsx("span",{children:"正在创建独立测试环境"})]}):C?l.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:l.jsx("span",{children:"配置已变更,请重新启动此环境"})}):y.messages.length===0?l.jsx("div",{className:"cw-ab-empty cw-ab-launch",children:O?l.jsxs(l.Fragment,{children:[l.jsx("strong",{className:"cw-ab-ready-title",children:"已就绪"}),l.jsx("span",{className:"cw-ab-launch-hint",children:"可在下方输入测试消息"})]}):l.jsx("span",{className:"cw-ab-launch-hint",children:L||"启动环境后即可加入本轮测试"})}):y.messages.map((T,M)=>l.jsx("div",{className:`cw-debug-msg cw-debug-msg-${T.role}`,children:l.jsx("div",{className:"cw-debug-content",children:T.role==="user"?T.content:T.error?l.jsx(wg,{message:T.error,className:"cw-debug-msg-error"}):T.blocks&&T.blocks.length>0?l.jsx(E_,{blocks:T.blocks,onAction:()=>{}}):T.content?T.content:M===y.messages.length-1&&y.phase==="sending"?l.jsx(w6,{}):null})},M))}),l.jsxs("footer",{className:"cw-ab-deploy-footer",children:[l.jsxs("button",{type:"button",className:"cw-ab-start cw-ab-footer-start",disabled:q,title:L||void 0,onClick:()=>o(y.id),children:[O||C||y.phase==="error"?l.jsx(oM,{className:"cw-i"}):l.jsx(T0e,{className:"cw-i cw-debug-run-icon"}),D]}),l.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:F||!b,onClick:()=>c(y.id),children:"部署该配置"})]})]}),l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!y.configOpen,children:[l.jsxs("header",{className:"cw-ab-config-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"测试配置"}),l.jsx("span",{children:y.name})]}),l.jsxs("span",{className:`cw-ab-config-done-wrap${L?" is-disabled":""}`,tabIndex:L?0:void 0,children:[l.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!y.configOpen||S,onClick:()=>h(y.id),children:y.id==="baseline"?"完成配置":"完成并启动"}),L&&l.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:L})]})]}),l.jsxs("div",{className:"cw-ab-config",children:[l.jsxs("label",{children:[l.jsx("span",{children:"模型"}),l.jsx("input",{value:y.modelName,placeholder:"使用 Agent 当前模型",disabled:!y.configOpen,onChange:T=>p(y.id,"modelName",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"描述"}),l.jsx("textarea",{rows:2,value:y.description,disabled:!y.configOpen,onChange:T=>p(y.id,"description",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"系统提示词"}),l.jsx("textarea",{rows:5,value:y.instruction,disabled:!y.configOpen,onChange:T=>p(y.id,"instruction",T.target.value)})]}),l.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[l.jsxs("legend",{children:[l.jsx("span",{children:"优化选项"}),l.jsx("em",{children:"待开放"})]}),l.jsx("div",{className:"cw-ab-optimization-list",children:F5.map(T=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:y.optimizations.includes(T.id),disabled:!0}),l.jsx("span",{children:T.label})]},T.id))})]}),l.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},y.id)}),n.length<3&&l.jsxs("button",{type:"button",className:"cw-ab-add",onClick:u,children:[l.jsx(ir,{className:"cw-i"}),l.jsx("strong",{children:"添加对照组"}),l.jsx("span",{children:"最多同时创建 3 个测试组"})]})]}):l.jsx("div",{className:"cw-debug-empty",children:t})}),l.jsx("div",{className:"cw-ab-composer",children:l.jsxs("div",{className:"cw-debug-composerbox",children:[l.jsx("textarea",{className:"cw-debug-input",rows:1,value:s,placeholder:x?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!x,onChange:y=>i(y.target.value),onKeyDown:y=>{v6(y.nativeEvent)||y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),a())}}),l.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!x||!s.trim(),onClick:a,children:g?l.jsx(Kt,{className:"cw-i cw-spin"}):l.jsx(WL,{className:"cw-i"})})]})})]})}const PC=[{id:"build",label:"构建"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],F5=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function V0e({mode:e,agentName:t,busy:n,onChange:r,onDiscard:s}){const i=PC.findIndex(a=>a.id===e);return l.jsxs("header",{className:"cw-workspace-header",children:[l.jsx("div",{className:"cw-workspace-identity",children:l.jsx("strong",{title:t,children:t||"未命名 Agent"})}),l.jsx("nav",{className:"cw-workspace-stepper","aria-label":"Agent 创建步骤",children:PC.map((a,o)=>{const c=a.id===e,u=or(a.id),children:l.jsx("strong",{children:a.label})},a.id)})}),s&&l.jsx("div",{className:"cw-workspace-actions",children:l.jsx("button",{type:"button",className:"cw-discard-edit",disabled:n,onClick:s,children:"放弃编辑"})})]})}function K0e({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:s,onDeploymentTaskChange:i,deploymentTarget:a,onDeploymentComplete:o,onDeploymentStarted:c,onDraftChange:u,onDiscard:d}){var Jn,Ea,Hi,wl,vl,xa,wa,va,mo,_a,Vs,vt,z,re,Ee;const[f,h]=E.useState(()=>r??jr()),[p,m]=E.useState(""),[g,x]=E.useState(!1),[y,w]=E.useState(!1),[b,_]=E.useState(null),k=E.useRef(JSON.stringify(f)),N=E.useRef(k.current),A=JSON.stringify(f),S=A!==k.current,C=E.useRef(u);E.useEffect(()=>{C.current=u},[u]),E.useEffect(()=>{var $;A!==N.current&&(N.current=A,($=C.current)==null||$.call(C,f,S))},[f,S,A]);const[R,O]=E.useState("build"),[F,q]=E.useState(!1),[L,D]=E.useState(!1),[T,M]=E.useState(0),[j,U]=E.useState(null),[I,K]=E.useState(!1),[W,B]=E.useState((a==null?void 0:a.region)??"cn-beijing"),ie=(s==null?void 0:s.generatedAgentTestRun)===!0,Q=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[ee,ce]=E.useState(()=>[{id:"baseline",name:"基准组",modelName:(r??jr()).modelName??"",description:(r??jr()).description,instruction:(r??jr()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[J,fe]=E.useState("baseline"),te=E.useRef(1),ge=E.useRef(new Map),[we,Z]=E.useState(0),[me,Ne]=E.useState(""),[Ie,We]=E.useState("basic"),[Ce,et]=E.useState(""),[Ge,Xe]=E.useState(!1),[xt,gt]=E.useState(!1),[At,ut]=E.useState(!1),[X,ne]=E.useState(!1),[he,Te]=E.useState([]),He=E.useRef(null),qe=E.useRef({});E.useEffect(()=>()=>{for(const{run:$}of ge.current.values())cd($.runId).catch(le=>console.warn("清理调试运行失败",le));ge.current.clear()},[]);const Ut=E.useRef(null);Ut.current||(Ut.current=({meta:$,children:le})=>l.jsxs("section",{ref:Re=>{qe.current[$.id]=Re},id:`cw-sec-${$.id}`,"data-step-id":$.id,className:"cw-section",children:[l.jsx("header",{className:"cw-sec-head",children:l.jsxs("h2",{className:"cw-sec-title",children:[$.label,$.required&&l.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),le]}));const Ye=D0e(f,he)?he:[],De=Tp(f,Ye),Be=Ye.length===0,Ct=`cw-model-advanced-${Ye.join("-")||"root"}`,un=`cw-a2a-registry-advanced-${Ye.join("-")||"root"}`,$t=`cw-more-tool-types-${Ye.join("-")||"root"}`,wn=`cw-advanced-config-${Ye.join("-")||"root"}`,Fe=$=>h(le=>bh(le,Ye,Re=>({...Re,...$}))),dt=($,le)=>h(Re=>{var $e;return{...Re,deployment:{...Re.deployment??{feishuEnabled:!1},envValues:{...(($e=Re.deployment)==null?void 0:$e.envValues)??{},[$]:le}}}}),Lt=$=>Fe({a2aRegistry:{...De.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...$}}),_t=($,le)=>{if(!($ in MC))return;const Re=MC[$];Lt({[Re]:le}),dt($,le)},be=$=>{if(!(Be&&$==="a2a")){if($==="a2a"){Fe({agentType:$,a2aRegistry:{...De.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}Fe({agentType:$,a2aRegistry:De.a2aRegistry?{...De.a2aRegistry,enabled:!1}:void 0})}},Ve=($,le)=>{h($),le&&Te(le)},st=async()=>{const $=p.trim();if(!(!$||g)&&!(S&&!window.confirm("生成的新配置会替换当前画布和属性,确定继续吗?"))){x(!0),w(!1),_(null),et("");try{const le=await FM($);h(D_(le.draft)),Te([]),U(null),D(!1),et(""),w(!0)}catch(le){_(le instanceof Error?le.message:"生成 Agent 配置失败")}finally{x(!1)}}},sn=$=>{const le=Tp(f,$);if(!yx(le)||$.length>=DC)return;const Re=P0e(f,$),$e=Tp(Re,$).subAgents.length-1;Ve(Re,[...$,$e])},an=($,le)=>{const Re=Tp(f,$);if(!yx(Re)||$.length>=DC)return;const $e=Math.max(0,Math.min(le,Re.subAgents.length)),pt=B0e(f,$,$e);Ve(pt,[...$,$e])},Ht=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(h(jr()),Te([]),D(!1),ne(!1))},zt=$=>{if($.length===0){Ht();return}Ve(F0e(f,$),$.slice(0,-1))},Bt=De.builtinTools??[],qt=De.mcpTools??[],vn=De.tracingExporters??[],Xt=De.selectedSkills??[],Ln=[De.memory.shortTerm,De.memory.longTerm,De.tracing].filter(Boolean).length,Mn=$=>Fe({builtinTools:Bt.includes($)?Bt.filter(le=>le!==$):[...Bt,$]}),ue=$=>{const le=vn.includes($)?vn.filter(Re=>Re!==$):[...vn,$];Fe({tracingExporters:le,tracing:le.length>0?!0:De.tracing})},_e=k5(De.agentType),ve=$0(De.agentType),ye=E.useMemo(()=>_5(f),[f]),nt=ve?null:Sc(De.name)??(ye.has(De.name)?"Agent 名称在当前结构中必须唯一":null),Qe=nt!==null,ct=!ve&&De.description.trim().length===0,ot=De.instruction.trim().length===0,oe=ve&&!((Jn=De.a2aRegistry)!=null&&Jn.registrySpaceId.trim()),Ze=$=>L&&$?`is-error cw-error-shake-${T%2}`:"",It=E.useMemo(()=>M5(f,ye),[f,ye]),it=It.length===0,kt=E.useMemo(()=>H0e(f),[f]),Ft=ee.find($=>$.id===J)??ee[0],Zn=E.useMemo(()=>D5(f),[f]),or=E.useMemo(()=>{var $,le,Re,$e;return{type:!0,basic:ve?!oe:!Qe&&(_e||!ot),model:!!(($=De.modelName)!=null&&$.trim()||(le=De.modelProvider)!=null&&le.trim()||(Re=De.modelApiBase)!=null&&Re.trim()),tools:Bt.length>0||qt.length>0,skills:Xt.length>0,knowledge:De.knowledgebase,advanced:De.memory.shortTerm||De.memory.longTerm||De.tracing,subagents:((($e=De.subAgents)==null?void 0:$e.length)??0)>0,review:it}},[De,Qe,ot,_e,ve,it,Bt,qt,Xt]),dn=_e||ve?["type","basic"]:["type","basic","model","tools","skills","knowledge",...Be?["advanced"]:[]],Zt=OC.filter($=>dn.includes($.id)),Yt=dn.join("|"),Jt=Ye.join("."),Mt=Zt.findIndex($=>$.id===Ie),Cn=$=>{var le;(le=qe.current[$])==null||le.scrollIntoView({behavior:"smooth",block:"start"})};E.useEffect(()=>{if(j)return;const $=He.current;if(!$)return;const le=Yt.split("|");let Re=0;const $e=()=>{Re=0;const at=le[le.length-1];let lt=le[0];if($.scrollTop+$.clientHeight>=$.scrollHeight-2)lt=at;else{const Yn=$.getBoundingClientRect().top+24;for(const yt of le){const er=qe.current[yt];if(!er||er.getBoundingClientRect().top>Yn)break;lt=yt}}lt&&We(Yn=>Yn===lt?Yn:lt)},pt=()=>{Re||(Re=window.requestAnimationFrame($e))};return $e(),$.addEventListener("scroll",pt,{passive:!0}),window.addEventListener("resize",pt),()=>{$.removeEventListener("scroll",pt),window.removeEventListener("resize",pt),Re&&window.cancelAnimationFrame(Re)}},[j,Yt,Jt]);const fn=()=>it?!0:(D(!0),M($=>$+1),It[0]&&(Te(It[0].path),window.requestAnimationFrame(()=>Cn("basic"))),!1),en=async()=>{const $=[...ge.current.values()];ge.current.clear(),Z(0),ce(le=>le.map(Re=>({...Re,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all($.map(async({run:le})=>{try{await cd(le.runId)}catch(Re){console.warn("清理调试运行失败",Re)}}))},Vn=async $=>{const le=ge.current.get($);if(le){ge.current.delete($),Z(ge.current.size);try{await cd(le.run.runId)}catch(Re){console.warn("清理调试运行失败",Re)}}},hn=async()=>R!=="validate"||we===0?!0:window.confirm("离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。")?(await en(),!0):!1,gr=async $=>{if(await hn()){if(et(""),!fn()){O("build");return}K(!0);try{const le=$?ee.find(pt=>pt.id===$):Ft;le&&fe(le.id);const Re=le?{...f,modelName:le.modelName||f.modelName,description:le.description,instruction:le.instruction}:f,$e=await pv(P5(Re));Re!==f&&h(Re),U($e),O("publish")}catch(le){et(le instanceof Error?le.message:String(le))}finally{K(!1)}}},Kn=async $=>{if(!ie||I||!fn())return;const le=ee.find(Rt=>Rt.id===$);if(!le||le.phase==="starting"||le.phase==="sending")return;const Re=le.modelName.trim(),$e=le.description.trim(),pt=le.instruction.trim(),at=cc(le),lt=ee.findIndex(Rt=>Rt.id===$),Yn=ee.findIndex(Rt=>cc(Rt)===at);if(!Re||!$e||!pt||Yn!==lt)return;const yt=_g(kt,le);ce(Rt=>Rt.map(cr=>cr.id===$?{...cr,configOpen:!1,phase:"starting",messages:[],error:null}:cr)),Ne("");let er=null;try{await Vn($);const Rt={...f,modelName:le.modelName||f.modelName,description:le.description,instruction:le.instruction};er=await UM(B5(Rt));const cr=await $M(er.runId,"test_user");ge.current.set($,{run:er,sessionId:cr}),Z(ge.current.size),ce(ur=>ur.map(_l=>_l.id===$?{..._l,phase:"ready",runtimeSnapshot:yt}:_l))}catch(Rt){if(er)try{await cd(er.runId)}catch(cr){console.warn("清理调试运行失败",cr)}ce(cr=>cr.map(ur=>ur.id===$?{...ur,phase:"error",runtimeSnapshot:"",error:Rt instanceof Error?Rt.message:String(Rt)}:ur))}},bs=async()=>{const $=me.trim(),le=ee.filter($e=>$e.phase==="ready"&&$e.runtimeSnapshot===_g(kt,$e)&&ge.current.has($e.id));if(!$||le.length===0)return;Ne("");const Re=new Set(le.map($e=>$e.id));ce($e=>$e.map(pt=>Re.has(pt.id)?{...pt,phase:"sending",messages:[...pt.messages,{role:"user",content:$},{role:"assistant",content:"",blocks:[]}]}:pt)),await Promise.all(le.map(async $e=>{const pt=ge.current.get($e.id);if(pt)try{let at=si();for await(const lt of HM({runId:pt.run.runId,userId:"test_user",sessionId:pt.sessionId,text:$})){const Yn=lt.error||lt.errorMessage||lt.error_message;if(ce(yt=>yt.map(er=>{if(er.id!==$e.id)return er;const Rt=[...er.messages],cr={...Rt[Rt.length-1]};return Yn?cr.error=String(Yn):(at=Pc(at,lt),cr.content=at.blocks.filter(ur=>ur.kind==="text").map(ur=>ur.text).join(""),cr.blocks=at.blocks),Rt[Rt.length-1]=cr,{...er,messages:Rt}})),Yn)break}}catch(at){ce(lt=>lt.map(Yn=>{if(Yn.id!==$e.id)return Yn;const yt=[...Yn.messages],er={...yt[yt.length-1]};return er.error=at instanceof Error?at.message:String(at),yt[yt.length-1]=er,{...Yn,messages:yt}}))}finally{ce(at=>at.map(lt=>lt.id===$e.id?{...lt,phase:"ready"}:lt))}}))},yr=()=>{ce($=>{if($.length>=3)return $;const le=te.current++,Re=`variant-${le}`;return[...$,{id:Re,name:`对照组 ${le}`,modelName:f.modelName??"",description:f.description,instruction:f.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},es=async $=>{await Vn($),ce(le=>le.filter(Re=>Re.id!==$)),J===$&&fe("baseline")},Es=($,le)=>ce(Re=>Re.map($e=>$e.id===$?{...$e,...le}:$e)),bi=($,le,Re)=>{Es($,{[le]:Re}),!(J!==$||$==="baseline")&&fe("baseline")},po=$=>{const le=ee.find(yt=>yt.id===$);if(!le)return;const Re=le.modelName.trim(),$e=le.description.trim(),pt=le.instruction.trim(),at=cc(le),lt=ee.findIndex(yt=>yt.id===$),Yn=ee.findIndex(yt=>cc(yt)===at);if(!(!Re||!$e||!pt||Yn!==lt)){if($==="baseline"){Es($,{configOpen:!1});return}Kn($)}},xs=async($,le,Re)=>{var at;const $e=(at=f.deployment)==null?void 0:at.network,pt=$e&&$e.mode&&$e.mode!=="public"?{mode:$e.mode,vpc_id:$e.vpcId,subnet_ids:$e.subnetIds,enable_shared_internet_access:$e.enableSharedInternetAccess}:void 0;return t0($.name,$.files,{region:(a==null?void 0:a.region)??W,projectName:"default",network:pt},{...Re,onStage:le,runtimeId:a==null?void 0:a.runtimeId,description:f.description})},Ei=()=>{fn()&&(ce($=>$.map(le=>le.id==="baseline"&&!ge.current.has(le.id)?{...le,modelName:f.modelName??"",description:f.description,instruction:f.instruction}:le)),O("validate"))},$i=async $=>{if($==="publish"){j?O("publish"):gr();return}if($==="validate"){Ei();return}await hn()&&O($)},Ur=Ut.current,Ar=$=>OC.find(le=>le.id===$);return l.jsxs("div",{className:"cw-root",children:[l.jsx(V0e,{mode:R,agentName:$0e(f),busy:I,onChange:$i,onDiscard:d?()=>{S?q(!0):d()}:void 0}),Ce&&l.jsx("div",{className:"cw-workspace-alert",role:"alert",children:Ce}),l.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[R==="build"&&l.jsxs("div",{className:"cw-build-workspace",children:[l.jsx("section",{className:`cw-ai-compose${g?" is-generating":""}${y?" is-success":""}`,"aria-label":"AI 自动填写 Agent 配置",children:l.jsx(ni,{initial:!1,mode:"wait",children:y?l.jsxs(Wt.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:[l.jsx("span",{className:"cw-ai-success-check","aria-hidden":!0}),l.jsx("strong",{children:"生成成功"}),l.jsx("button",{type:"button",className:"cw-ai-regenerate",onClick:()=>w(!1),children:"重新生成"})]},"success"):l.jsxs(Wt.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:[l.jsxs("form",{className:"cw-ai-compose-form",onSubmit:$=>{$.preventDefault(),st()},children:[l.jsx("input",{type:"text",value:p,maxLength:8e3,disabled:g,placeholder:"输入您的目标",onChange:$=>m($.target.value),onKeyDown:$=>{$.key==="Enter"&&($.preventDefault(),st())}}),l.jsx("button",{type:"submit",disabled:g||!p.trim(),"aria-label":g?"正在智能生成":"智能生成",children:g?l.jsx("span",{className:"cw-ai-orb","aria-hidden":!0,children:l.jsx("span",{})}):"智能生成"})]}),l.jsx("p",{className:"cw-ai-compose-note",children:"使用 doubao-seed-2-0-lite-260428 模型生成,将会产生 Token 消耗"})]},"compose")})}),l.jsxs("div",{className:"cw-editor",children:[l.jsx(yg,{draft:f,direction:"vertical",selectedPath:Ye,onSelect:Te,onAdd:sn,onInsert:an,onDelete:zt}),l.jsxs("div",{className:"cw-detail",children:[l.jsx("div",{className:"cw-detail-scroll",ref:He,children:l.jsx("div",{className:"cw-detail-inner",children:l.jsxs("div",{className:"cw-lower",children:[l.jsxs("div",{className:"cw-form-col",children:[l.jsx(Ur,{meta:Ar("type"),children:l.jsx("div",{className:"cw-agent-type-options",role:"radiogroup","aria-label":"Agent 类型",children:s0e.map($=>{const le=(De.agentType??"llm")===$.id,Re=Be&&$.id==="a2a",$e=Re?"cw-remote-agent-disabled-hint":void 0;return l.jsxs("label",{"data-agent-type":$.id,className:`cw-agent-type-option ${le?"is-on":""} ${Re?"is-disabled":""}`,title:Re?void 0:LC[$.id],tabIndex:Re?0:void 0,"aria-describedby":$e,children:[l.jsx("input",{type:"radio",name:"agentType",className:"cw-agent-type-radio",checked:le,disabled:Re,onChange:()=>be($.id)}),l.jsxs("span",{className:"cw-agent-type-copy",children:[l.jsx("strong",{children:A0e[$.id]}),l.jsx("small",{children:LC[$.id]})]}),Re&&l.jsx("span",{id:$e,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},$.id)})})}),l.jsx(Ur,{meta:Ar("basic"),children:l.jsxs("div",{className:"cw-form",children:[!ve&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Be?"Agent 名称":"名称",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("input",{className:`cw-input ${Ze(Qe)}`,value:De.name,placeholder:"customer_service",onChange:$=>Fe({name:$.target.value})}),L&&nt?l.jsx("span",{className:"cw-error-text",children:nt}):l.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Be?"描述":"智能体描述",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Ze(ct)}`,value:De.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:$=>Fe({description:$.target.value})}),L&&ct?l.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):l.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),_e?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"cw-section-desc",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),De.agentType==="loop"&&l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"最大轮次"}),l.jsx("input",{className:"cw-input",type:"number",min:1,value:De.maxIterations??3,onChange:$=>Fe({maxIterations:Math.max(1,Number($.target.value)||1)})}),l.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):ve?l.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[l.jsxs("div",{className:"cw-remote-center-head",children:[l.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),l.jsx(R0e,{value:((Ea=De.a2aRegistry)==null?void 0:Ea.registrySpaceId)??"",region:((Hi=De.a2aRegistry)==null?void 0:Hi.registryRegion)||ui.region,invalid:L&&oe,onChange:$=>_t(R5,$)}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":xt,"aria-controls":un,onClick:()=>gt($=>!$),children:[l.jsx("span",{children:"更多选项"}),l.jsx(Ms,{className:`cw-more-options-chevron ${xt?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:xt&&l.jsx(Wt.div,{id:un,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:l.jsx(Ml,{env:C0e,values:O5(De.a2aRegistry,{includeDefaults:!1}),onChange:_t})})}),L&&oe&&l.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:["系统提示词",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx(E.Suspense,{fallback:l.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:l.jsx(N0e,{value:De.instruction,invalid:ot,onChange:$=>Fe({instruction:$})})}),L&&ot?l.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):l.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!_e&&!ve&&l.jsxs(l.Fragment,{children:[l.jsx(Ur,{meta:Ar("model"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"模型名称"}),l.jsx("input",{className:"cw-input",value:De.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:$=>Fe({modelName:$.target.value})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":Ge,"aria-controls":Ct,onClick:()=>Xe($=>!$),children:[l.jsx("span",{children:"更多选项"}),l.jsx(Ms,{className:`cw-more-options-chevron ${Ge?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:Ge&&l.jsxs(Wt.div,{id:Ct,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:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"服务商 Provider"}),l.jsx("input",{className:"cw-input",value:De.modelProvider??"",placeholder:"openai",onChange:$=>Fe({modelProvider:$.target.value})})]}),l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"API Base"}),l.jsx("input",{className:"cw-input",value:De.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:$=>Fe({modelApiBase:$.target.value})}),l.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),l.jsx(Ur,{meta:Ar("tools"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"内置工具"}),l.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),l.jsx("div",{className:"cw-tools-list-shell",children:l.jsx(jC,{items:rl,selected:Bt,onToggle:Mn,scrollRows:6})}),l.jsx(ni,{initial:!1,children:Bt.includes("run_code")&&l.jsxs(Wt.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:[l.jsxs("div",{className:"cw-tool-config-head",children:[l.jsx("span",{className:"cw-label",children:"代码执行配置"}),l.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),l.jsx(Ml,{env:((wl=rl.find($=>$.id==="run_code"))==null?void 0:wl.env)??[],values:((vl=f.deployment)==null?void 0:vl.envValues)??{},onChange:dt})]})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":At,"aria-controls":$t,onClick:()=>ut($=>!$),children:[l.jsx("span",{children:"更多类型工具"}),qt.length>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",qt.length]}),l.jsx(Ms,{className:`cw-more-options-chevron ${At?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(ni,{initial:!1,children:At&&l.jsx(Wt.div,{id:$t,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:l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"MCP 工具"}),l.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),l.jsx(L0e,{tools:qt,onChange:$=>Fe({mcpTools:$})})]})})})]})}),l.jsx(Ur,{meta:Ar("skills"),children:l.jsx("div",{className:"cw-form",children:l.jsx(j0e,{selected:Xt,onChange:$=>Fe({selectedSkills:$})})})}),l.jsx(Ur,{meta:Ar("knowledge"),children:l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(ed,{checked:De.knowledgebase,onChange:$=>Fe({knowledgebase:$}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:Kp}),De.knowledgebase&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"知识库后端"}),l.jsx(Db,{options:xE,value:De.knowledgebaseBackend,onChange:$=>Fe({knowledgebaseBackend:$,knowledgebaseIndex:$==="viking"?De.knowledgebaseIndex:""})}),(De.knowledgebaseBackend??Uc)==="viking"&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),l.jsx(O0e,{value:De.knowledgebaseIndex??"",onChange:$=>Fe({knowledgebaseIndex:$})})]}),l.jsx(Ml,{env:((xa=xE.find($=>$.id===(De.knowledgebaseBackend??Uc)))==null?void 0:xa.env)??[],values:((wa=f.deployment)==null?void 0:wa.envValues)??{},onChange:dt})]})]})}),Be&&l.jsxs("section",{ref:$=>{qe.current.advanced=$},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[l.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":X,"aria-controls":wn,onClick:()=>ne($=>!$),children:[l.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),l.jsx(Ms,{className:`cw-advanced-disclosure-chevron ${X?"is-open":""}`,"aria-hidden":!0}),Ln>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",Ln]})]}),l.jsx(ni,{initial:!1,children:X&&l.jsxs(Wt.div,{id:wn,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"记忆"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(ed,{checked:De.memory.shortTerm,onChange:$=>Fe({memory:{...De.memory,shortTerm:$}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:rM}),De.memory.shortTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"短期记忆后端"}),l.jsx(Db,{options:bE,value:De.shortTermBackend,onChange:$=>Fe({shortTermBackend:$})}),l.jsx(Ml,{env:((va=bE.find($=>$.id===(De.shortTermBackend??"local")))==null?void 0:va.env)??[],values:((mo=f.deployment)==null?void 0:mo.envValues)??{},onChange:dt})]}),l.jsx(ed,{checked:De.memory.longTerm,onChange:$=>Fe({memory:{...De.memory,longTerm:$}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:Kp}),De.memory.longTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"长期记忆后端"}),l.jsx(Db,{options:EE,value:De.longTermBackend,onChange:$=>Fe({longTermBackend:$})}),l.jsx(Ml,{env:((_a=EE.find($=>$.id===(De.longTermBackend??"local")))==null?void 0:_a.env)??[],values:((Vs=f.deployment)==null?void 0:Vs.envValues)??{},onChange:dt}),l.jsx(ed,{checked:!!De.autoSaveSession,onChange:$=>Fe({autoSaveSession:$}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:Kp})]})]})]}),l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"观测"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(ed,{checked:De.tracing,onChange:$=>Fe({tracing:$}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:ZL}),De.tracing&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),l.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),l.jsx(jC,{items:wE,selected:vn,onToggle:ue}),l.jsx(Ml,{env:wE.filter($=>vn.includes($.id)).flatMap($=>$.env),values:((vt=f.deployment)==null?void 0:vt.envValues)??{},onChange:dt})]})]})]})]})})]})]})]}),l.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:l.jsxs("ol",{className:"cw-steps",children:[l.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:l.jsx(Wt.div,{className:"cw-rail-fill",animate:{height:`${Math.max(Mt,0)/Math.max(Zt.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),Zt.map($=>{const le=$.id===Ie,Re=or[$.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",className:`cw-step ${le?"is-active":""} ${Re?"is-done":""}`,onClick:()=>Cn($.id),"aria-current":le?"step":void 0,"aria-label":$.label,children:[l.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:le?l.jsx("span",{className:"cw-dot"}):Re?l.jsx(pi,{className:"cw-step-check"}):l.jsx("span",{className:"cw-dot"})}),l.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:$.label})]})},$.id)})]})})]})})}),l.jsx("button",{type:"button",className:"cw-build-next studio-update-action",onClick:Ei,children:l.jsx("span",{children:"开始调试"})})]})]})]}),R==="validate"&&l.jsx("div",{className:"cw-validation-workspace",children:l.jsx("div",{className:"cw-validation-content",children:l.jsx(z0e,{enabled:ie,disabledReason:Q,variants:ee,draftSnapshot:kt,input:me,onInput:Ne,onSend:bs,onStartVariant:Kn,onDeployVariant:$=>void gr($),onAddVariant:yr,onRemoveVariant:es,onToggleConfig:$=>{const le=ee.find(Re=>Re.id===$);le&&Es($,{configOpen:!le.configOpen})},onCompleteConfig:po,onConfigChange:bi})})}),R==="publish"&&l.jsx("div",{className:"cw-preview-body",children:j?l.jsx(U0,{embedded:!0,project:j,agentDraft:f,agentName:f.name||"未命名 Agent",agentCount:j5(f),releaseConfiguration:Ft?{modelName:Ft.modelName||f.modelName||"默认模型",description:Ft.description,instruction:Ft.instruction,optimizations:Ft.optimizations.flatMap($=>{const le=F5.find(Re=>Re.id===$);return le?[le.label]:[]})}:void 0,onChange:U,onDeploy:xs,onAgentAdded:n,onDeploymentTaskChange:i,deploymentActionLabel:a?"更新并发布":"部署",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:c,onDeploymentComplete:o,feishuEnabled:!!((z=f.deployment)!=null&&z.feishuEnabled),onFeishuEnabledChange:$=>{const le={...f,deployment:{...f.deployment??{feishuEnabled:!1},feishuEnabled:$}};h(le)},deploymentEnv:Zn.specs,deploymentEnvValues:{...(re=f.deployment)==null?void 0:re.envValues,...Zn.fixedValues},onDeploymentEnvChange:dt,network:(Ee=f.deployment)==null?void 0:Ee.network,onNetworkChange:$=>h(le=>({...le,deployment:{...le.deployment??{feishuEnabled:!1},network:$}})),deployRegion:W,onDeployRegionChange:B,onExportYaml:()=>S0e(`${f.name||"agent"}.yaml`,Tge(f),"text/yaml")}):l.jsxs("div",{className:"cw-publish-loading",role:"status",children:[l.jsx(Kt,{className:"cw-i cw-spin"}),l.jsx("strong",{children:"正在生成发布配置"}),l.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),F&&l.jsx("div",{className:"confirm-scrim",onClick:()=>q(!1),children:l.jsxs("div",{className:"confirm-box",role:"dialog","aria-modal":"true","aria-labelledby":"discard-edit-title",onClick:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"discard-edit-title",children:"放弃本次编辑?"}),l.jsx("div",{className:"confirm-text",children:"本次修改将不会保留,智能体会恢复到进入编辑前的状态。"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>q(!1),children:"继续编辑"}),l.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",onClick:()=>{q(!1),d==null||d()},children:"放弃编辑"})]})]})}),b&&l.jsx("div",{className:"confirm-scrim",onClick:()=>_(null),children:l.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:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"ai-generate-error-title",children:"智能生成失败"}),l.jsx("div",{className:"cw-ai-error-message",id:"ai-generate-error-message",children:b}),l.jsx("div",{className:"confirm-actions",children:l.jsx("button",{type:"button",className:"confirm-btn cw-ai-error-close",onClick:()=>_(null),children:"关闭"})})]})})]})}function qi(e){return{...jr(),...e}}const Y0e=[{id:"support",icon:wz,draft:qi({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:sz,draft:qi({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:vz,draft:qi({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Qw,draft:qi({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:Cz,draft:qi({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:Hz,draft:qi({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[qi({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),qi({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),qi({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function G0e(e){const t=[];return e.tools.length&&t.push({icon:lM,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:rz,label:"记忆"}),e.knowledgebase&&t.push({icon:nz,label:"知识库"}),e.tracing&&t.push({icon:ez,label:"观测"}),e.subAgents.length&&t.push({icon:aM,label:`子Agent ${e.subAgents.length}`}),t}function W0e({onBack:e,onCreate:t}){const[n,r]=E.useState(null);return l.jsx("div",{className:"tpl-root",children:n?l.jsx(X0e,{template:n,onBack:()=>r(null),onCreate:t}):l.jsx(q0e,{onPick:r})})}function q0e({onPick:e}){return l.jsxs("div",{className:"tpl-scroll",children:[l.jsxs("div",{className:"tpl-head",children:[l.jsx("h1",{className:"tpl-title",children:"从模板新建"}),l.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),l.jsx("div",{className:"tpl-grid",children:Y0e.map((t,n)=>l.jsxs(Wt.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:[l.jsx("span",{className:"tpl-card-icon",children:l.jsx(t.icon,{className:"icon"})}),l.jsx("span",{className:"tpl-card-name",children:t.draft.name}),l.jsx("span",{className:"tpl-card-desc",children:Hs(t.draft.description)})]},t.id))})]})}function X0e({template:e,onBack:t,onCreate:n}){const[r,s]=E.useState(e.draft.name),i=e.icon,a=G0e(e.draft);function o(){const c=r.trim()||e.draft.name;n({...e.draft,name:c})}return l.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[l.jsxs("button",{className:"tpl-back",onClick:t,children:[l.jsx(qw,{className:"icon"})," 返回模板列表"]}),l.jsxs(Wt.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[l.jsxs("div",{className:"tpl-detail-head",children:[l.jsx("span",{className:"tpl-detail-icon",children:l.jsx(i,{className:"icon"})}),l.jsxs("div",{className:"tpl-detail-headtext",children:[l.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),l.jsx("div",{className:"tpl-detail-desc",children:Hs(e.draft.description)})]})]}),a.length>0&&l.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>l.jsxs("span",{className:"tpl-tag",children:[l.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),l.jsxs("label",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"名称"}),l.jsx("input",{className:"tpl-input",value:r,onChange:c=>s(c.target.value),placeholder:e.draft.name})]}),l.jsxs("div",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),l.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),l.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"模型"}),l.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"工具"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"记忆"}),l.jsx("span",{className:"tpl-meta-val",children:Q0e(e.draft)})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"知识库"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&l.jsxs("div",{className:"tpl-field",children:[l.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),l.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>l.jsxs("div",{className:"tpl-subagent",children:[l.jsxs("div",{className:"tpl-subagent-top",children:[l.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&l.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),l.jsx("div",{className:"tpl-subagent-desc",children:Hs(c.description)})]},u))})]}),l.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",l.jsx(Ms,{className:"icon"})]})]})]})}function Q0e(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const Z0e=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:sM},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:GL},{type:"loop",label:"循环",desc:"节点循环执行",Icon:nv}];let bx=0;function $b(){return bx+=1,`node_${bx}`}function Hb(e,t,n){const r=jr();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function J0e({data:e,selected:t}){const n=e.agent;return l.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[l.jsx(kr,{type:"target",position:Ue.Left,className:"wfb-handle"}),l.jsx("div",{className:"wfb-node-icon",children:l.jsx(tl,{className:"icon"})}),l.jsxs("div",{className:"wfb-node-body",children:[l.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),l.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),l.jsx(kr,{type:"source",position:Ue.Right,className:"wfb-handle"})]})}const eye={agentNode:J0e},BC={type:"smoothstep",markerEnd:{type:qc.ArrowClosed,width:16,height:16}};function tye({onBack:e,onCreate:t}){const n=E.useRef(null),[r,s]=E.useState(""),[i,a]=E.useState(""),[o,c]=E.useState("sequential"),u=E.useMemo(()=>{bx=0;const T=$b();return Hb(T,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=C4([u]),[p,m,g]=I4([]),[x,y]=E.useState(u.id),w=d.find(T=>T.id===x)??null,b=r.trim()||"workflow_agent",_=E.useMemo(()=>_5({name:b,subAgents:d.map(T=>T.data.agent)}),[b,d]),k=Sc(b)??(_.has(b)?"名称须与 Agent 节点名称保持唯一":null),N=w?Sc(w.data.agent.name)??(_.has(w.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,A=d.length>0&&k===null&&d.every(T=>Sc(T.data.agent.name)===null&&!_.has(T.data.agent.name)),S=E.useCallback(T=>m(M=>r4({...T,...BC},M)),[m]),C=E.useCallback(()=>{const T=$b(),M=d.length*28,j=Hb(T,{x:80+M,y:120+M});f(U=>U.concat(j)),y(T)},[d.length,f]),R=T=>{T.dataTransfer.setData("application/wfb-node","agentNode"),T.dataTransfer.effectAllowed="move"},O=E.useCallback(T=>{T.preventDefault(),T.dataTransfer.dropEffect="move"},[]),F=E.useCallback(T=>{if(T.preventDefault(),T.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const j=n.current.screenToFlowPosition({x:T.clientX,y:T.clientY}),U=$b(),I=Hb(U,j);f(K=>K.concat(I)),y(U)},[f]),q=E.useCallback(T=>{x&&f(M=>M.map(j=>j.id===x?{...j,data:{...j.data,agent:{...j.data.agent,...T}}}:j))},[x,f]),L=E.useCallback(()=>{x&&(f(T=>T.filter(M=>M.id!==x)),m(T=>T.filter(M=>M.source!==x&&M.target!==x)),y(null))},[x,f,m]),D=E.useCallback(()=>{if(!A)return;const T=d.map(j=>j.data.agent),M={...jr(),name:b,description:i.trim(),instruction:i.trim(),subAgents:T,workflow:{type:o,nodes:d.map(j=>({id:j.id,agent:j.data.agent})),edges:p.map(j=>({from:j.source,to:j.target}))}};t(M)},[A,d,p,b,i,o,t]);return l.jsx("div",{className:"wfb",children:l.jsxs("div",{className:"wfb-grid",children:[l.jsxs("aside",{className:"wfb-palette",children:[l.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:T=>s(T.target.value),placeholder:"my_workflow"}),k&&l.jsx("span",{className:"wfb-field-error",children:k})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:i,onChange:T=>a(T.target.value),placeholder:"这个工作流做什么…",rows:2})]}),l.jsx("div",{className:"wfb-section-label",children:"执行方式"}),l.jsx("div",{className:"wfb-types",children:Z0e.map(({type:T,label:M,desc:j,Icon:U})=>l.jsxs("button",{type:"button",className:`wfb-type ${o===T?"wfb-type--active":""}`,onClick:()=>c(T),children:[l.jsx(U,{className:"icon"}),l.jsxs("span",{className:"wfb-type-text",children:[l.jsx("span",{className:"wfb-type-name",children:M}),l.jsx("span",{className:"wfb-type-desc",children:j})]})]},T))}),l.jsx("div",{className:"wfb-section-label",children:"节点"}),l.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:R,title:"拖拽到画布,或点击下方按钮添加",children:[l.jsx(xz,{className:"icon wfb-grip"}),l.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:l.jsx(tl,{className:"icon"})}),l.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),l.jsxs("button",{className:"wfb-add",type:"button",onClick:C,children:[l.jsx(ir,{className:"icon"}),"添加节点"]}),l.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),l.jsxs("div",{className:"wfb-canvas",children:[l.jsxs("button",{className:"wfb-create",onClick:D,disabled:!A,type:"button",children:[l.jsx(nl,{className:"icon"}),"创建工作流"]}),l.jsxs(A4,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:g,onConnect:S,onInit:T=>n.current=T,nodeTypes:eye,defaultEdgeOptions:BC,onDrop:F,onDragOver:O,onNodeClick:(T,M)=>y(M.id),onPaneClick:()=>y(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[l.jsx(O4,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),l.jsx(M4,{showInteractive:!1}),l.jsx(xde,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),l.jsx("aside",{className:"wfb-inspector",children:w?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"wfb-inspector-head",children:[l.jsx("div",{className:"wfb-section-label",children:"节点配置"}),l.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:L,title:"删除节点",children:l.jsx(js,{className:"icon"})})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${N?"wfb-input--error":""}`,value:w.data.agent.name,onChange:T=>q({name:T.target.value}),placeholder:"agent_name"}),N?l.jsx("span",{className:"wfb-field-error",children:N}):l.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("input",{className:"wfb-input",value:w.data.agent.description,onChange:T=>q({description:T.target.value}),placeholder:"这个 agent 做什么…"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:w.data.agent.instruction,onChange:T=>q({instruction:T.target.value}),placeholder:"你是一个…",rows:6})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),l.jsx("input",{className:"wfb-input",value:w.data.agent.tools.join(", "),onChange:T=>q({tools:T.target.value.split(",").map(M=>M.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),l.jsxs("div",{className:"wfb-inspector-meta",children:[l.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),l.jsx("code",{className:"wfb-meta-val",children:w.id})]})]}):l.jsxs("div",{className:"wfb-inspector-empty",children:[l.jsx(tl,{className:"wfb-empty-icon"}),l.jsx("p",{children:"选择一个节点以编辑其配置"}),l.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function nye(e){return l.jsx(c_,{children:l.jsx(tye,{...e})})}const FC=50*1024*1024,Ex=800,rye={name:"code_package",files:[]};function sye(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 iye(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(r=>!r||r==="."||r===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function aye(e){const t=e.flatMap(a=>{const o=iye(a.name);return o?[{path:o,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>Ex)throw new Error(`代码包文件数不能超过 ${Ex} 个。`);const s=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,i=new Set;for(const a of s){if(i.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);i.add(a.path)}if(!i.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return s}function oye({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n}){const r=E.useRef(null),s=E.useRef(0),[i,a]=E.useState(null),[o,c]=E.useState(""),[u,d]=E.useState(!1),[f,h]=E.useState(!1),[p,m]=E.useState(!1),[g,x]=E.useState(""),[y,w]=E.useState("cn-beijing"),[b,_]=E.useState();E.useEffect(()=>()=>{s.current+=1},[]);async function k(C){const R=++s.current;if(x(""),!C.name.toLowerCase().endsWith(".zip")){x("请选择 .zip 格式的代码包。");return}if(C.size>FC){x("代码包不能超过 50 MB。");return}h(!0);try{const O=await N5(new Uint8Array(await C.arrayBuffer()),{maxEntries:Ex,maxUncompressedBytes:FC}),F=aye(O);if(R!==s.current)return;c(C.name),a({name:sye(C.name),files:F})}catch(O){if(R!==s.current)return;c(""),a(null),x(O instanceof Error?O.message:String(O))}finally{R===s.current&&h(!1)}}function N(C){var O;const R=(O=C.currentTarget.files)==null?void 0:O[0];C.currentTarget.value="",R&&k(R)}function A(C){var O;C.preventDefault(),m(!1);const R=(O=C.dataTransfer.files)==null?void 0:O[0];R&&k(R)}async function S(C,R,O){const F=b&&b.mode!=="public"?{mode:b.mode,vpc_id:b.vpcId,subnet_ids:b.subnetIds,enable_shared_internet_access:b.enableSharedInternetAccess}:void 0;return t0(C.name,C.files,{region:y,projectName:"default",network:F},{...O,onStage:R})}return l.jsxs("div",{className:"package-create package-create-preview",children:[l.jsx(U0,{project:i??rye,agentName:(i==null?void 0:i.name)||"代码包",onChange:i?a:void 0,onDeploy:S,onAgentAdded:t,onDeploymentTaskChange:n,network:b,onNetworkChange:_,deployRegion:y,onDeployRegionChange:w,onBack:e,backLabel:"返回创建方式",deployDisabled:!i||f,deployDisabledReason:f?"正在读取代码包":i?void 0:"请先上传代码包",deploymentPrimaryPane:l.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[l.jsx("div",{className:"package-source-label",children:"代码包"}),l.jsxs("div",{className:`package-dropzone${p?" is-dragging":""}${i?" is-ready":""}`,onDragEnter:C=>{C.preventDefault(),m(!0)},onDragOver:C=>C.preventDefault(),onDragLeave:C=>{C.currentTarget.contains(C.relatedTarget)||m(!1)},onDrop:A,onClick:()=>{var C;f||(C=r.current)==null||C.click()},onKeyDown:C=>{var R;!f&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),(R=r.current)==null||R.click())},role:"button",tabIndex:f?-1:0,"aria-label":i?"重新上传代码包":"上传代码包","aria-disabled":f,children:[l.jsx("strong",{children:f?"正在读取代码包…":i?o:"请上传代码包"}),l.jsx("span",{children:i?`已识别 ${i.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),l.jsx("div",{className:"package-upload-actions",children:i&&l.jsx("button",{type:"button",className:"package-upload-secondary",onClick:C=>{C.stopPropagation(),d(!0)},onKeyDown:C=>C.stopPropagation(),children:"查看文件"})}),l.jsx("input",{ref:r,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:N})]}),g&&l.jsx("div",{className:"package-create-error",role:"alert",children:g})]})}),i&&l.jsx(v5,{project:i,open:u,onClose:()=>d(!1),onChange:a})]})}const lye=3*60*1e3,cye=3e3,uye=10*60*1e3,kg="veadk.studio.pending-update",UC=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],dye={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function fye(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function hye(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function pye(){if(typeof window>"u")return null;const e=window.localStorage.getItem(kg);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(kg),null}function zb(e,t){window.localStorage.setItem(kg,JSON.stringify({targetVersion:e,startedAt:t}))}function Ap(){window.localStorage.removeItem(kg)}function $C({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),l.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),l.jsx("path",{d:"M12 7.8v7.7"}),l.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function mye(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m4 6 4 4 4-4"})})}function gye(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function HC({lines:e,phase:t,copyState:n,onCopy:r}){const s=E.useRef(null),i=E.useRef(!0);return E.useEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[e]),l.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[l.jsxs("div",{className:"studio-update-log-header",children:[l.jsxs("span",{children:[l.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",l.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),l.jsx("button",{type:"button",onClick:r,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),l.jsx("div",{ref:s,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const o=a.currentTarget;i.current=o.scrollHeight-o.scrollTop-o.clientHeight<24},children:e.length?e.map((a,o)=>l.jsx("div",{children:a},`${o}-${a}`)):l.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function yye(){var q,L;const[e]=E.useState(pye),[t,n]=E.useState(null),[r,s]=E.useState(e?"submitting":"idle"),[i,a]=E.useState(!1),[o,c]=E.useState(""),[u,d]=E.useState((e==null?void 0:e.targetVersion)??""),[f,h]=E.useState(!1),[p,m]=E.useState("idle"),[g,x]=E.useState(0),y=E.useRef(null),w=E.useRef((e==null?void 0:e.targetVersion)??""),b=E.useRef((e==null?void 0:e.startedAt)??0);E.useEffect(()=>{if(!f)return;const D=M=>{var j;M.target instanceof Node&&!((j=y.current)!=null&&j.contains(M.target))&&h(!1)},T=M=>{M.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",D),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",D),window.removeEventListener("keydown",T)}},[f]);const _=E.useCallback(async()=>{const D=await jM(w.current||void 0,b.current||void 0);return n(D),D},[]);if(E.useEffect(()=>{let D=!0;const T=()=>{_().catch(()=>{D&&n(j=>j)})};T();const M=window.setInterval(T,lye);return()=>{D=!1,window.clearInterval(M)}},[_]),E.useEffect(()=>{if(r!=="submitting")return;const D=window.setInterval(()=>{_().then(T=>{const M=w.current;if(M&&hye(T.currentVersion,M)||!M&&!T.available&&T.latestVersion){window.clearInterval(D),Ap(),s("published"),c("Studio 已更新,刷新页面即可使用新版本");return}if(T.state==="error"){window.clearInterval(D),Ap(),s("error"),c(T.message||"Studio 更新失败");return}Date.now()-b.current>uye&&(window.clearInterval(D),Ap(),s("error"),c("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},cye);return()=>window.clearInterval(D)},[r,_]),E.useEffect(()=>{r!=="idle"||(t==null?void 0:t.state)!=="updating"||(w.current=t.targetVersion,b.current=t.startedAt||Date.now(),zb(t.targetVersion,b.current),d(t.targetVersion),s("submitting"))},[r,t]),E.useEffect(()=>{if(r!=="submitting"){x(0);return}const D=()=>{const M=b.current||Date.now();x(Math.max(0,Math.floor((Date.now()-M)/1e3)))};D();const T=window.setInterval(D,1e3);return()=>window.clearInterval(T)},[r]),!(t!=null&&t.enabled)||!(t.available||t.state==="updating"||r!=="idle"))return null;const N=t.releases??[],A=u||((q=N[0])==null?void 0:q.version)||t.latestVersion,S=N.find(D=>D.version===A),C=async()=>{w.current=A,b.current=Date.now(),zb(A,b.current),s("submitting"),c(""),m("idle");try{const D=await DM(A);w.current=D.version,zb(D.version,b.current),c("更新已提交,正在等待 VeFaaS 发布新版本")}catch(D){if(D instanceof TypeError){c("连接已切换,正在确认新版本状态");return}Ap(),s("error");const T=D instanceof Error?D.message:"Studio 更新失败";try{const M=await _();c(M.message||T)}catch{c(T)}}},R=(L=t.updateLogs)!=null&&L.length?t.updateLogs:(t.errorLog||t.progressMessage||o).split(` `).filter(Boolean),O=async()=>{try{await navigator.clipboard.writeText(R.join(` -`)),m("copied")}catch{m("error")}},F=()=>{var D;h(!1),m("idle"),c(""),d(w.current||((D=N[0])==null?void 0:D.version)||""),s("confirm")};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`studio-update-trigger is-${r}`,title:r==="submitting"?"正在更新 Studio":r==="published"?"Studio 已更新":`更新 Studio 至 ${t.latestVersion}`,onClick:()=>{var D;r==="published"?window.location.reload():(r==="submitting"||r==="error"||(d(((D=N[0])==null?void 0:D.version)||t.latestVersion),s("confirm")),a(!0))},children:[l.jsx($C,{className:"studio-update-icon"}),r==="submitting"?l.jsx(pa,{as:"span",children:"正在更新"}):r==="published"?l.jsx("span",{children:"刷新使用新版"}):r==="error"?l.jsx("span",{children:"更新失败"}):l.jsx("span",{children:"有新版更新"})]}),i&&r!=="idle"&&l.jsx("div",{className:"confirm-scrim",role:"presentation",children:l.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[l.jsx("div",{className:"studio-update-dialog-mark",children:l.jsx($C,{})}),l.jsx("div",{id:"studio-update-title",className:"confirm-title",children:r==="error"?"Studio 更新失败":r==="submitting"?"正在更新 Studio":r==="published"?"Studio 更新完成":"发现新版本"}),r==="error"?l.jsxs("div",{className:"studio-update-error-panel",children:[l.jsx("p",{className:"confirm-text studio-update-error",children:o}),l.jsxs("dl",{className:"studio-update-error-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"失败阶段"}),l.jsx("dd",{children:uye[t.errorStage]||t.errorStage||"未知阶段"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"错误 ID"}),l.jsx("dd",{children:t.errorId||"未生成"})]})]}),l.jsx(HC,{lines:R,phase:"error",copyState:p,onCopy:()=>void O()}),t.consoleUrl&&l.jsxs("a",{className:"studio-update-console-link",href:t.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",l.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):r==="submitting"||r==="published"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"studio-update-progress-summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"目标版本"}),l.jsx("strong",{children:w.current||A})]}),l.jsxs("div",{children:[l.jsx("span",{children:r==="published"?"更新状态":"已用时"}),l.jsx("strong",{children:r==="published"?"已完成":dye(g)})]})]}),l.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:UC.map((D,T)=>{const M=UC.findIndex(I=>I.id===t.progressStage),j=r==="published"||Tvoid O()}),l.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),l.jsxs("div",{className:"studio-update-field",ref:y,children:[l.jsx("span",{children:"选择版本"}),l.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":f,onClick:()=>h(D=>!D),onKeyDown:D=>{(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),h(!0))},children:[l.jsx("span",{children:A}),l.jsx(pye,{})]}),f&&l.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:N.map(D=>{const T=D.version===A;return l.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`studio-update-version-option${T?" is-selected":""}`,onClick:()=>{d(D.version),h(!1)},children:[l.jsx("span",{children:D.version}),T&&l.jsx(mye,{})]},D.version)})})]}),l.jsxs("dl",{className:"studio-update-versions",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:t.currentVersion})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"目标版本"}),l.jsx("dd",{children:A})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Commit"}),l.jsx("dd",{children:((S==null?void 0:S.gitSha)||t.latestGitSha).slice(0,8)})]})]}),l.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[l.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),S!=null&&S.changelog.length?l.jsx("ul",{children:S.changelog.map(D=>l.jsx("li",{children:D},D))}):l.jsx("p",{children:"暂无更新说明"})]})]}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{a(!1),h(!1),r==="confirm"&&(s("idle"),c(""))},children:r==="submitting"?"后台运行":r==="confirm"?"取消":"关闭"}),r==="confirm"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void C(),children:"立即更新"}),r==="error"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:F,children:"重新尝试"})]})]})})]})}const yye="/web/skill-creator";class P_ extends Error{constructor(n,r){super(n);lk(this,"status");this.name="SkillCreatorApiError",this.status=r}}function xl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function gn(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function U5(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function Eh(e,t){return fetch(ji(`${yye}${e}`),{...t,headers:Zg({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function B_(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=xl(await e.json(),"错误响应");return gn(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function F_(e,t){if(!e.ok)throw new P_(await B_(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function bye(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 Eye(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function xye(e){return Array.isArray(e)?e.map((t,n)=>{const r=xl(t,`文件 ${n+1}`),s=gn(r,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const i=U5(r,"size");if(i===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:i}}):[]}function wye(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function vye(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=xl(t,`活动 ${n+1}`),s=gn(r,"id"),i=gn(r,"kind"),a=gn(r,"status");if(!s||!i||!["status","thinking","tool","message"].includes(i))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(i==="tool"){const c=gn(r,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:i,name:c,args:r.input,response:r.output,status:a}}const o=gn(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:i,text:o,status:a}})}function _ye(e,t){const n=xl(e,`候选方案 ${t+1}`),r=gn(n,"id","candidate_id","candidateId"),s=gn(n,"model","model_id","modelId");if(!r||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:s,modelLabel:gn(n,"modelLabel","model_label")??s,status:bye(n.status),stage:Eye(n.stage),name:gn(n,"name","skill_name","skillName"),description:gn(n,"description"),skillMd:gn(n,"skillMd","skill_md"),files:xye(n.files),activities:vye(n.activities),validation:wye(n.validation),durationMs:U5(n,"elapsedMs","elapsed_ms"),error:gn(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:gn(n,"skill_id","skillId"),version:gn(n,"version")}}function xx(e,t=""){const n=xl(e,"Skill 创建任务"),r=gn(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(_ye):[],i=gn(n,"status")??"running";if(i!=="provisioning"&&i!=="running"&&i!=="completed")throw new Error(`未知的 Skill 任务状态:${i}`);return{id:r,prompt:gn(n,"prompt")??t,status:i,candidates:s}}async function kye(e,t){const n=await Eh("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new P_(await B_(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=xx(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),i=new TextDecoder;let a="",o;const c=u=>{if(!u.trim())return;const d=xl(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(gn(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=xx(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await s.read();a+=i.decode(d,{stream:!u});const f=a.split(` -`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function Nye(e){const t=await Eh(`/jobs/${encodeURIComponent(e)}`);return xx(await F_(t,"读取 Skill 任务失败"))}async function Sye(e){const t=await Eh(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await F_(t,"清理 Skill 任务失败")}async function Tye(e,t){var o;const n=await Eh(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await B_(n,"下载 Skill 失败"));const s=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",i=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}async function Aye(e,t,n){const r=await Eh(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=xl(await F_(r,"添加到 AgentKit 失败"),"发布结果"),i=gn(s,"skill_id","skillId","id");if(!i)throw new Error("发布结果缺少 skill_id");return{skillId:i,name:gn(s,"name"),version:gn(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:gn(s,"message")}}const Cye=()=>{};function Iye(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 Rye({activities:e}){const t=E.useMemo(()=>e.filter(n=>n.kind!=="status").map(Iye),[e]);return t.length===0?null:l.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:l.jsx(E_,{blocks:t,onAction:Cye})})}const zC={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},VC=12e4;function Oye({status:e}){return e==="succeeded"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):l.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function Lye(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),l.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function Mye(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function jye({candidate:e}){var c,u;const[t,n]=E.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,i=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,VC),o=(((u=e.skillMd)==null?void 0:u.length)??0)>VC;return s.length===0?null:l.jsxs("div",{className:"skill-files",children:[l.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:s.map(d=>l.jsx("button",{type:"button",role:"tab","aria-selected":(i==null?void 0:i.path)===d.path,className:(i==null?void 0:i.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(i!=null&&i.path.endsWith("SKILL.md"))?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"skill-files__content",children:l.jsx("code",{children:a})}),o?l.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):l.jsx("div",{className:"skill-files__unavailable",children:i?`${i.path} · ${i.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function Dye({label:e,jobId:t,candidate:n,selected:r,publishing:s,publishDisabled:i,publishError:a,onSelect:o,onPublish:c}){const[u,d]=E.useState("conversation"),[f,h]=E.useState(!1),[p,m]=E.useState(!1),[g,x]=E.useState(""),[y,w]=E.useState(""),[b,_]=E.useState(""),[k,N]=E.useState(""),A=E.useRef(null),S=E.useRef(null),C=n.status==="queued"||n.status==="running",R=n.status==="succeeded",O=n.validation;return l.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[l.jsxs("header",{className:"skill-candidate__header",children:[l.jsx("h2",{children:n.model}),r?l.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[l.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[l.jsx("span",{className:"skill-candidate__status-icon",children:l.jsx(Oye,{status:n.status})}),C?l.jsx(pa,{duration:2.2,spread:16,children:zC[n.stage]}):l.jsx("span",{children:zC[n.stage]}),n.durationMs!==void 0&&R?l.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),l.jsx(Rye,{activities:n.activities}),n.error?l.jsx("div",{className:"skill-candidate__error",children:n.error}):null,R?l.jsx("div",{className:"skill-candidate__view-actions",children:l.jsxs("button",{ref:A,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var F;return(F=S.current)==null?void 0:F.focus()})},children:[l.jsx(Lye,{}),"查看 Skill"]})}):null]}):l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[l.jsx("div",{className:"skill-candidate__preview-nav",children:l.jsxs("button",{ref:S,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var F;return(F=A.current)==null?void 0:F.focus()})},children:[l.jsx(Mye,{}),"返回对话"]})}),l.jsxs("div",{className:"skill-candidate__result",children:[l.jsxs("div",{className:"skill-candidate__summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"Skill"}),l.jsx("strong",{children:n.name??"未命名 Skill"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"文件"}),l.jsx("strong",{children:n.files.length})]}),l.jsxs("div",{children:[l.jsx("span",{children:"校验"}),l.jsx("strong",{className:(O==null?void 0:O.valid)===!1?"is-invalid":"is-valid",children:(O==null?void 0:O.valid)===!1?"未通过":"已通过"})]})]}),n.description?l.jsx("p",{className:"skill-candidate__description",children:n.description}):null,O&&(O.errors.length>0||O.warnings.length>0)?l.jsxs("details",{className:"skill-validation",children:[l.jsx("summary",{children:"查看校验详情"}),[...O.errors,...O.warnings].map((F,q)=>l.jsx("div",{children:F},`${F}-${q}`))]}):null,l.jsx(jye,{candidate:n}),l.jsxs("div",{className:"skill-candidate__actions",children:[l.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),l.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),x(""),Tye(t,n.id).catch(F=>{x(F instanceof Error?F.message:String(F))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),l.jsx("button",{type:"button",className:"skill-action",disabled:!r||s||i||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(F=>!F),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),g?l.jsx("div",{className:"skill-candidate__error",children:g}):null,f&&r&&!n.published?l.jsxs("form",{className:"skill-publish-form",onSubmit:F=>{F.preventDefault();const q=y.split(",").map(L=>L.trim()).filter(Boolean);c({skillSpaceIds:q,...b.trim()?{projectName:b.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[l.jsxs("label",{children:[l.jsx("span",{children:"SkillSpace ID(可选)"}),l.jsx("input",{value:y,onChange:F=>w(F.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),l.jsxs("div",{className:"skill-publish-form__optional",children:[l.jsxs("label",{children:[l.jsx("span",{children:"项目名称(可选)"}),l.jsx("input",{value:b,onChange:F=>_(F.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"已有 Skill ID(可选)"}),l.jsx("input",{value:k,onChange:F=>N(F.target.value)})]})]}),l.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?l.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const KC=new Set(["completed"]),Cp=1100,Pye=3e4;function Bye(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 Fye({initialJob:e}){const[t,n]=E.useState(e),[r,s]=E.useState(""),[i,a]=E.useState(!1),[o,c]=E.useState(),[u,d]=E.useState(),[f,h]=E.useState(()=>new Set),[p,m]=E.useState({});E.useEffect(()=>{n(e),s(""),a(!1)},[e]),E.useEffect(()=>{if(KC.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,w;const b=Date.now()+Pye,_=async()=>{try{const k=await Nye(e.id);y||(n({...k,prompt:k.prompt||e.prompt}),s(""),KC.has(k.status)||(w=window.setTimeout(_,Cp)))}catch(k){if(!y){const N=k instanceof P_?k:void 0;if((N==null?void 0:N.status)===404&&Date.now(){y=!0,w!==void 0&&window.clearTimeout(w)}},[e.id,e.status]);const g=x_.map((y,w)=>t.candidates.find(b=>b.model===y)??t.candidates[w]??Bye(y,w));async function x(y,w){d(y.id),m(b=>({...b,[y.id]:""}));try{await Aye(t.id,y.id,w),h(b=>new Set(b).add(y.id))}catch(b){m(_=>({..._,[y.id]:b instanceof Error?b.message:String(b)}))}finally{d(void 0)}}return l.jsxs("section",{className:"skill-workspace",children:[l.jsx("header",{className:"skill-workspace__intro",children:l.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?l.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",i?"":"页面会继续重试。"]}):null,l.jsx("div",{className:"skill-workspace__grid",children:g.map((y,w)=>{const _=f.has(y.id)||y.published?{...y,published:!0}:y;return l.jsx(Dye,{label:`方案 ${w===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:k=>void x(y,k)},`${y.model}-${y.id}`)})})]})}const Vb="/web/sandbox/sessions",Uye=33e4,$ye=6e5,Hye=15e3;function Kb(e){const t=Zg(e);return t.set("Accept","application/json"),t}async function Yb(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,s=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof s=="string"&&s?s:t)}async function zye(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let s="",i="";const a=[],o=new Map;function c(){t==null||t(a.map(h=>({...h})))}function u(h){i+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),c()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const g=o.get(h.id);g===void 0?(o.set(h.id,a.length),a.push(m)):a[g]=m,c()}function f(h){let p="message";const m=[];for(const x of h.split(/\r?\n/))x.startsWith("event:")&&(p=x.slice(6).trim()),x.startsWith("data:")&&m.push(x.slice(5).trimStart());if(m.length===0)return;let g;try{g=JSON.parse(m.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof g.message=="string"&&g.message?g.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(g),p==="delta"&&typeof g.text=="string"&&u(g.text),p==="done"&&!i&&typeof g.text=="string"&&u(g.text)}for(;;){const{done:h,value:p}=await n.read();s+=r.decode(p,{stream:!h});const m=s.split(/\r?\n\r?\n/);if(s=m.pop()??"",m.forEach(f),h)break}if(s.trim()&&f(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:i,blocks:a}}const Gb={async startSession(e={}){const t=await fetch(ji(Vb),{method:"POST",headers:Kb({"Content-Type":"application/json"}),signal:ci(e.signal,Uye)});if(!t.ok)throw await Yb(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(ji(`${Vb}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:Kb({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:ci(t.signal,$ye)});if(!n.ok)throw await Yb(n,"沙箱对话失败,请稍后重试。");return zye(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(ji(`${Vb}/${encodeURIComponent(e)}`),{method:"DELETE",headers:Kb(),signal:ci(t.signal,Hye)});if(!n.ok&&n.status!==404)throw await Yb(n,"无法清理 AgentKit 沙箱会话。")}},Vye=1e4;async function $5(e){const t=await fetch(ji(e),{headers:Zg({Accept:"application/json"}),signal:ci(void 0,Vye)});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 Kye(){return $5("/web/sandbox/capabilities")}async function Yye(){return $5("/web/skill-creator/capabilities")}function Gye(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),l.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),l.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function Wye({open:e,state:t,error:n,onCancel:r,onConfirm:s}){const i=E.useRef(null),a=E.useRef(null);if(E.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var x;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(x=i.current)==null?void 0:x.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],g=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",c=o?"正在初始化沙箱":t==="error"?"启动失败":"启用 Codex 智能体";return Us.createPortal(l.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:l.jsxs("section",{ref:i,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[l.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[l.jsx("span",{className:"sandbox-dialog-orbit"}),l.jsx("span",{className:"sandbox-dialog-icon",children:o?l.jsx("span",{className:"sandbox-spinner"}):l.jsx(Gye,{})})]}),l.jsxs("div",{className:"sandbox-dialog-copy",children:[l.jsx("h2",{id:"sandbox-dialog-title",children:c}),t==="error"?l.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?l.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建内置智能体会话,通常需要一点时间。"}):l.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex 智能体,本次对话不会被持久化保存。"})]}),l.jsxs("footer",{className:"sandbox-dialog-actions",children:[l.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&l.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function qye({onExit:e}){return l.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[l.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),l.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为 Codex 智能体会话,退出后对话内容消失"}),l.jsx("button",{type:"button",onClick:e,children:"退出内置智能体"})]})}function Xye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Qye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}const YC=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Wb(e){let t=0;for(let n=0;n>>0;return YC[t%YC.length]}function Zye(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];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):r.push(u);const s=(u,d)=>u.start_time-d.start_time,i=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>i(f,d+1))}),a=r.sort(s).map(u=>i(u,0)),o=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:o,total:c-o||1}}function Jye(e,t){const n=[],r=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(r)};return e.forEach(r),n}function GC(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const ebe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function WC(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:ebe(t),value:r,long:r.length>80||r.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function tbe({appName:e,sessionId:t,onClose:n}){const[r,s]=E.useState(null),[i,a]=E.useState(""),[o,c]=E.useState(new Set),[u,d]=E.useState(null);E.useEffect(()=>{s(null),a(""),vM(e,t).then(w=>{s(w),d(w.length?w.reduce((b,_)=>b.start_time<=_.start_time?b:_).span_id:null)}).catch(w=>a(String(w)))},[e,t]);const{rootNodes:f,min:h,total:p}=E.useMemo(()=>Zye(r??[]),[r]),m=E.useMemo(()=>Jye(f,o),[f,o]),g=(r==null?void 0:r.find(w=>w.span_id===u))??null,x=p/1e6,y=w=>c(b=>{const _=new Set(b);return _.has(w)?_.delete(w):_.add(w),_});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim",onClick:n}),l.jsxs("aside",{className:"drawer drawer--trace",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{className:"drawer-title",children:"调用链路观测"}),l.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${x.toFixed(1)} ms`:"加载中"})]}),l.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:l.jsx(Zr,{className:"icon"})})]}),r==null&&!i&&l.jsxs("div",{className:"drawer-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载调用链路…"]}),i&&l.jsx("div",{className:"error",children:i}),r&&r.length===0&&l.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&l.jsxs("div",{className:"trace-split",children:[l.jsx("div",{className:"trace-tree scroll",children:m.map(w=>{const b=w.span,_=(b.start_time-h)/p*100,k=Math.max((b.end_time-b.start_time)/p*100,.6),N=w.children.length>0;return l.jsxs("button",{className:`trace-row ${u===b.span_id?"active":""}`,onClick:()=>d(b.span_id),children:[l.jsxs("span",{className:"trace-label",style:{paddingLeft:w.depth*14},children:[l.jsx("span",{className:`trace-caret ${N?"":"hidden"} ${o.has(b.span_id)?"":"open"}`,onClick:A=>{A.stopPropagation(),N&&y(b.span_id)},children:l.jsx(Ms,{className:"chev"})}),l.jsx("span",{className:"trace-dot",style:{background:Wb(b.name)}}),l.jsx("span",{className:"trace-name",title:b.name,children:b.name})]}),l.jsx("span",{className:"trace-dur",children:GC(b.end_time-b.start_time)}),l.jsx("span",{className:"trace-track",children:l.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:Wb(b.name)}})})]},b.span_id)})}),l.jsx("div",{className:"trace-detail scroll",children:g?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"td-title",children:g.name}),l.jsxs("div",{className:"td-dur",children:[l.jsx("span",{className:"td-dot",style:{background:Wb(g.name)}}),GC(g.end_time-g.start_time)]}),l.jsx("div",{className:"td-section",children:"属性"}),l.jsx("div",{className:"td-props",children:WC(g).filter(w=>!w.long).map(w=>l.jsxs("div",{className:"td-prop",children:[l.jsx("span",{className:"td-key",children:w.key}),l.jsx("span",{className:"td-val",children:w.value})]},w.key))}),WC(g).filter(w=>w.long).map(w=>l.jsxs("div",{className:"td-block",children:[l.jsx("div",{className:"td-section",children:w.key}),l.jsx("pre",{className:"td-pre",children:w.value})]},w.key))]}):l.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function nbe(e){return e.toLowerCase()==="github"?l.jsx(Ez,{className:"icon"}):l.jsx(Nz,{className:"icon"})}function rbe({branding:e,onUsername:t}){const[n,r]=E.useState(null),[s,i]=E.useState(""),[a,o]=E.useState(0),[c,u]=E.useState(""),d=E.useRef(null);E.useEffect(()=>{let m=!0;return r(null),i(""),dM().then(g=>{m&&r(g)}).catch(g=>{m&&i(g instanceof Error?g.message:String(g))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;E.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=Yz.test(c),p=()=>{h&&t(c)};return l.jsxs("div",{className:"login",children:[l.jsx("header",{className:"login-top",children:l.jsxs("span",{className:"login-brand",children:[l.jsx("img",{className:"login-brand-logo",src:e.logoUrl||mv,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),l.jsx("main",{className:"login-main",children:l.jsxs("div",{className:"login-card",children:[l.jsx(pa,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?l.jsxs("div",{className:"login-provider-error",role:"alert",children:[l.jsx("p",{children:s}),l.jsx("button",{type:"button",onClick:()=>o(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"登录以继续使用"}),l.jsx("div",{className:"login-providers",children:n.map(m=>l.jsxs("button",{className:"login-btn",onClick:()=>Wz(m.loginUrl),children:[nbe(m.id),l.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),l.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[l.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),l.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:l.jsx(Cd,{className:"icon"})})]}),l.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),l.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),l.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",l.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),l.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function sbe({open:e,checking:t,error:n,onLogin:r}){const s=E.useRef(null);return E.useEffect(()=>{var a;if(!e)return;const i=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=i}},[e]),e?Us.createPortal(l.jsx("div",{className:"auth-expired-backdrop",children:l.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[l.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:l.jsx(qg,{})}),l.jsxs("div",{className:"auth-expired-copy",children:[l.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),l.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&l.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),l.jsx("footer",{className:"auth-expired-actions",children:l.jsx("button",{ref:s,type:"button",onClick:r,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function ibe({node:e,ctx:t}){const n=e.variant??"default";return l.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}El("Button",ibe);function abe({node:e,ctx:t}){return l.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}El("Card",abe);const obe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},lbe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function H5(e){return obe[e]??"flex-start"}function z5(e){return lbe[e]??"stretch"}function cbe({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:H5(e.justify),alignItems:z5(e.align)},children:n.map(r=>t.render(r))})}El("Column",cbe);function ube({node:e}){const t=e.axis==="vertical";return l.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}El("Divider",ube);const dbe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function fbe({node:e}){const t=e.name??"";return l.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:dbe[t]??"•"})}El("Icon",fbe);function hbe({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:H5(e.justify),alignItems:z5(e.align??"center")},children:n.map(r=>t.render(r))})}El("Row",hbe);const pbe=new Set(["h1","h2","h3","h4","h5"]);function mbe({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),s=pbe.has(n)?n:"p";return l.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}El("Text",mbe);const gbe="创建 Agent",ybe={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流",package:"代码包部署"},Io={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},bbe=new Set,Ebe=[];function Xi(){return{skills:[]}}function Lo(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function qb(e){return`${Lo(e)}.active`}function wx(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function xbe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(Lo(e))||"[]");return Array.isArray(t)?t:[]}catch{return[]}}function wbe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(wx(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function vx(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const r=vx(n,t);if(r)return r}}function V5(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...V5(n)));return t}function qC(){const e=typeof localStorage<"u"?localStorage.getItem(Io.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function vbe({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),l.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function _be(){return l.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),l.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function K5(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function kbe(e){if(!e)return"";const t=[];return e.ts&&t.push(K5(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function XC(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const Nbe="send_a2ui_json_to_client";function Sbe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===Nbe&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?h6(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function Tbe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Abe(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let i=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},o=d=>{if(!i){i=!0,a();try{s.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!i){if(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(i=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function Cbe(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=r.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,r.oauth2=s,n.exchangedAuthCredential=r,n}function QC({text:e}){const[t,n]=E.useState(!1);return l.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?l.jsx(pi,{className:"icon"}):l.jsx(Zw,{className:"icon"})})}function Ibe(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function Rbe({tasks:e,onCancel:t}){const[n,r]=E.useState(!1),[s,i]=E.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],c=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{i(f.id),t(f).finally(()=>i(null))};return l.jsxs("div",{className:"global-deploy-center",children:[l.jsxs("button",{type:"button",className:`global-deploy-task is-${c}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[c==="running"?l.jsx(Kt,{className:"global-deploy-task-icon spin"}):c==="success"?l.jsx(QL,{className:"global-deploy-task-icon"}):c==="error"?l.jsx(qg,{className:"global-deploy-task-icon"}):c==="cancelled"?l.jsx(cE,{className:"global-deploy-task-icon"}):l.jsx(kz,{className:"global-deploy-task-icon"}),l.jsx("span",{className:"global-deploy-task-detail",children:u}),l.jsx(Xw,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),l.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[l.jsxs("header",{className:"global-deploy-popover-head",children:[l.jsx("span",{children:"部署任务"}),l.jsx("span",{children:e.length})]}),l.jsx("div",{className:"global-deploy-list",children:e.length===0?l.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return l.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[l.jsxs("div",{className:"global-deploy-item-head",children:[l.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),l.jsx("span",{className:"global-deploy-status",children:h})]}),l.jsxs("dl",{className:"global-deploy-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime 名称"}),l.jsx("dd",{children:f.runtimeName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署地域"}),l.jsx("dd",{children:Ibe(f.region)})]}),f.runtimeId&&l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime ID"}),l.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?l.jsx(wg,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?l.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:l.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),l.jsx("div",{className:"global-deploy-item-actions",children:l.jsx("button",{type:"button",disabled:s===f.id,onClick:()=>d(f),children:s===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const ZC=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],JC=()=>ZC[Math.floor(Math.random()*ZC.length)];function Xb(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function Obe(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Lbe(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function Mbe(){const[e,t]=E.useState([]),[n,r]=E.useState(""),[s,i]=E.useState([]),[a,o]=E.useState(""),c=E.useRef(null),[u,d]=E.useState(!1),[f,h]=E.useState([]),[p,m]=E.useState(null),[g,x]=E.useState([]),[y,w]=E.useState(!1),[b,_]=E.useState(!1),[k,N]=E.useState("confirm"),[A,S]=E.useState(""),C=E.useRef(null),R=E.useRef(null),[O,F]=E.useState({}),q=a?O[a]??[]:f,L=p?g:q,D=(P,Y)=>F(ae=>({...ae,[P]:typeof Y=="function"?Y(ae[P]??[]):Y})),[T,M]=E.useState(""),[j,U]=E.useState("agent"),[I,K]=E.useState({}),[W,B]=E.useState(null),[ie,Q]=E.useState(!1),ee=E.useRef(0),[ce,J]=E.useState([]),[fe,te]=E.useState(Xi),[ge,we]=E.useState(null),[Z,me]=E.useState(!1),[Ne,Ie]=E.useState(null),[We,Ce]=E.useState(!1),[et,Ge]=E.useState([]),[Xe,xt]=E.useState(!1),gt=E.useRef(new Set),[At,ut]=E.useState(()=>new Set),[X,ne]=E.useState(()=>new Set),he=E.useRef(new Map),Te=E.useRef(new Map),He=(P,Y)=>ut(ae=>{const de=new Set(ae);return Y?de.add(P):de.delete(P),de}),qe=P=>{const Y=Te.current.get(P);Y!==void 0&&window.clearTimeout(Y),Te.current.delete(P),ne(ae=>new Set(ae).add(P))},Ut=P=>{const Y=Te.current.get(P);Y!==void 0&&window.clearTimeout(Y);const ae=window.setTimeout(()=>{Te.current.delete(P),ne(de=>{const Se=new Set(de);return Se.delete(P),Se})},2400);Te.current.set(P,ae)},Ye=E.useRef(""),[De,Be]=E.useState(""),[Ct,un]=E.useState(""),$t=E.useRef(null);E.useEffect(()=>()=>{$t.current!==null&&window.clearTimeout($t.current)},[]);const[wn,Fe]=E.useState(()=>new Set),[dt,Lt]=E.useState(!1),[_t,be]=E.useState(!1),Ve=E.useRef(null),st=E.useCallback(()=>be(!1),[]),[sn,an]=E.useState(JC),[Ht,zt]=E.useState(null),[Bt,qt]=E.useState(!1),[vn,Xt]=E.useState(!1),[Ln,Mn]=E.useState(""),ue=E.useRef(!1),[_e,ve]=E.useState(null),[ye,nt]=E.useState(""),[Qe,ct]=E.useState(),[ot,oe]=E.useState(null),[Ze,It]=E.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[it,kt]=E.useState("cloud"),[Ft,Zn]=E.useState(Ef),[or,lr]=E.useState(""),[dn,Zt]=E.useState("chat"),[Yt,Jt]=E.useState(!1),[Mt,Cn]=E.useState(!1),[fn,en]=E.useState(!1),[Vn,hn]=E.useState({}),[gr,Kn]=E.useState({}),[bs,yr]=E.useState({}),es=At.has(a),Es=X.has(a),bi=es||u,po=!!a&&We,xs=p?y:bi,Ei=xs||!p&&Es,$i=Vn[a]??"",Ur=gr[a]??bbe,Ar=bs[a]??Ebe,Jn=ge==null?void 0:ge.graph,Ea=[ge==null?void 0:ge.name,Jn==null?void 0:Jn.name,Jn==null?void 0:Jn.id].filter(P=>!!P),Hi=fe.targetAgent&&Jn?vx(Jn,fe.targetAgent.name):Jn,wl=(Hi==null?void 0:Hi.skills)??(fe.targetAgent?[]:(ge==null?void 0:ge.skills)??[]),vl=Jn?V5(Jn):[];function xa(P){Xb(P);for(const Y of P)Y.status==="uploading"?gt.current.add(Y.id):Y.uri&&Gp(n,Y.uri).catch(ae=>Be(String(ae)))}function wa(){ee.current+=1;const P=W;B(null),Q(!1),P&&!P.id.startsWith("pending-")&&Sye(P.id).catch(Y=>{Be(Y instanceof Error?Y.message:String(Y))})}async function va(P){try{await hE(n,ye,P),await fE(n,ye,P),i(Y=>Y.filter(ae=>ae.id!==P)),F(Y=>{const{[P]:ae,...de}=Y;return de})}catch(Y){Be(String(Y))}}function mo(P){const Y=ce.find(Se=>Se.id===P);if(!Y)return;const ae=ce.filter(Se=>Se.id!==P);Xb([Y]),Y.status==="uploading"&>.current.add(P),J(ae),ae.length===0&&!T.trim()&&!!a&&L.length===0?(Ye.current="",o(""),va(a)):Y.uri&&Gp(n,Y.uri).catch(Se=>Be(String(Se)))}const _a=(P,Y)=>{var xe,Me,Ke,Pe,jt;const ae=Y.author&&Y.author!=="user"?Y.author:void 0;ae&&(hn(tt=>({...tt,[P]:ae})),Kn(tt=>({...tt,[P]:new Set(tt[P]??[]).add(ae)})),yr(tt=>{var ft;return(ft=tt[P])!=null&&ft.length?tt:{...tt,[P]:[ae]}}));const de=((xe=Y.actions)==null?void 0:xe.transferToAgent)??((Me=Y.actions)==null?void 0:Me.transfer_to_agent);de&&yr(tt=>{const ft=tt[P]??[];return ft[ft.length-1]===de?tt:{...tt,[P]:[...ft,de]}}),(((Ke=Y.actions)==null?void 0:Ke.endOfAgent)??((Pe=Y.actions)==null?void 0:Pe.end_of_agent)??((jt=Y.actions)==null?void 0:jt.escalate))&&yr(tt=>{const ft=tt[P]??[];return ft.length<=1?tt:{...tt,[P]:ft.slice(0,-1)}})},[Vs,vt]=E.useState(qC),[z,re]=E.useState([]),Ee=E.useCallback(P=>{re(Y=>{const ae=Y.findIndex(Se=>Se.id===P.id);if(ae===-1)return[P,...Y];const de=[...Y];return de[ae]={...de[ae],...P},de})},[]),$=E.useCallback(async P=>{try{await RM(P.id),re(Y=>Y.map(ae=>ae.id===P.id?{...ae,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:ae))}catch(Y){const ae=Y instanceof Error?Y.message:String(Y);re(de=>de.map(Se=>Se.id===P.id?{...Se,message:`取消失败:${ae}`}:Se))}},[]),[le,Re]=E.useState(!0),[$e,pt]=E.useState(!1),[at,lt]=E.useState(!1),[Yn,yt]=E.useState(!1),[er,Rt]=E.useState(null),[cr,ur]=E.useState([]),[_l,xh]=E.useState([]),[$r,Ks]=E.useState(""),ws=E.useRef(null),[wh,Hr]=E.useState(!1),[H0,pn]=E.useState(!1),[U_,z0]=E.useState(""),[Y5,G5]=E.useState("good"),[W5,vu]=E.useState("basic"),[q5,X5]=E.useState("good"),[vh,_h]=E.useState(""),[_u,Cr]=E.useState(!1),V0=E.useRef(null),[ku,go]=E.useState(()=>{const P=os();return cu(P),P}),[Q5,$_]=E.useState(!1),[Z5,K0]=E.useState(""),[H_,kh]=E.useState(null),[J5,z_]=E.useState({}),[kl,xi]=E.useState(null),[V_,vs]=E.useState(""),[Y0,ts]=E.useState(""),[_s,Ys]=E.useState(null),[eB,Nh]=E.useState(!1),G0=E.useRef(!1),Sh=E.useRef(!1),tB=E.useCallback((P,Y,ae)=>{!P||!ye||ur(de=>{const xe=[{id:P,draft:Y,updatedAt:Date.now(),deploymentTarget:ae},...de.filter(Me=>Me.id!==P)];return localStorage.setItem(Lo(ye),JSON.stringify(xe)),xe})},[ye]),W0=E.useCallback(P=>{!P||!ye||ur(Y=>{const ae=Y.filter(de=>de.id!==P);return localStorage.setItem(Lo(ye),JSON.stringify(ae)),ae})},[ye]),nB=E.useCallback(P=>{if(!ye||P.length===0)return;const Y=new Set(P.map(ae=>ae.id));ur(ae=>{const de=ae.filter(Se=>!Y.has(Se.id));return localStorage.setItem(Lo(ye),JSON.stringify(de)),de}),Y.has($r)&&(Ks(""),Rt(null),xi(null),ws.current=null,localStorage.removeItem(qb(ye)))},[$r,ye]),K_=E.useCallback(P=>{if(!P||!ye)return;const Y=ws.current;ur(ae=>{const de=ae.filter(xe=>xe.id!==P),Se=(Y==null?void 0:Y.id)===P?[Y,...de]:de;return localStorage.setItem(Lo(ye),JSON.stringify(Se)),Se})},[ye]);E.useEffect(()=>{if(!ye){ur([]),xh([]),Ks(""),ws.current=null;return}const P=xbe(ye);ur(P),xh(wbe(ye));const Y=localStorage.getItem(qb(ye))||"",ae=P.find(de=>de.id===Y);ws.current=ae??null,Vs==="custom"&&ae&&(Ks(ae.id),Rt(ae.draft),xi(ae.deploymentTarget??null))},[ye]),E.useEffect(()=>{if(!ye)return;const P=qb(ye);Vs==="custom"&&$r?localStorage.setItem(P,$r):localStorage.removeItem(P)},[Vs,$r,ye]);const rB=E.useCallback(P=>{if(!ye)return;const Y=[...new Set(P.filter(Boolean))];xh(Y),localStorage.setItem(wx(ye),JSON.stringify(Y))},[ye]),sB=E.useCallback(async P=>{const Y=P.filter(xe=>!!xe.runtimeId&&xe.canDelete===!0);if(Y.length===0)return;const ae=new Set,de=new Set,Se=[];for(const xe of Y)try{await BM(xe.runtimeId,xe.region??"cn-beijing"),Gm(xe.runtimeId),ae.add(xe.runtimeId),de.add(xe.id)}catch(Me){const Ke=Me instanceof Error?Me.message:String(Me);Se.push(`${xe.label}: ${Ke}`)}if(ae.size>0&&(go(os()),kh(xe=>{if(!xe)return xe;const Me=new Set(xe);for(const Ke of ae)Me.delete(Ke);return Me}),z_(xe=>Object.fromEntries(Object.entries(xe).filter(([Me])=>!ae.has(Me)))),xh(xe=>{const Me=xe.filter(Ke=>!de.has(Ke));return ye&&localStorage.setItem(wx(ye),JSON.stringify(Me)),Me}),ur(xe=>{const Me=xe.filter(Ke=>{var Pe;return!((Pe=Ke.deploymentTarget)!=null&&Pe.runtimeId)||!ae.has(Ke.deploymentTarget.runtimeId)});return ye&&localStorage.setItem(Lo(ye),JSON.stringify(Me)),Me}),Y.some(xe=>xe.id===n)&&(Ye.current="",o(""),r(""))),Se.length>0){const xe=Se.slice(0,3).join(";"),Me=Se.length>3?`;另有 ${Se.length-3} 个失败`:"";throw new Error(`${Se.length} 个 Agent 删除失败:${xe}${Me}`)}},[n,ye]),q0=E.useCallback(async()=>{$_(!0),K0("");try{const P=[];let Y="";do{const de=await yc({scope:"mine",region:"all",pageSize:100,nextToken:Y});P.push(...de.runtimes),Y=de.nextToken}while(Y&&P.length<2e3);kh(new Set(P.map(de=>de.runtimeId))),z_(Object.fromEntries(P.map(de=>[de.runtimeId,{canDelete:de.canDelete}])));const ae=[];for(const de of P)try{await Od(de.runtimeId,de.name,de.region,de.currentVersion)}catch{ae.push(de.name)}go(os()),ae.length>0&&K0(`${ae.length} 个 Runtime 暂时无法读取,请稍后重试。`)}catch(P){K0(P instanceof Error?P.message:String(P))}finally{$_(!1)}},[]);function Th(P){console.log("create agent draft:",P),vt(null),xo()}function X0(P,Y){console.log("Agent added, navigating to:",P,Y),go(os()),kh(null),W0($r),Ks(""),ws.current=null,xi(null),vs(""),ts(P),vu("basic"),vt(null),pn(!0),r(P)}const iB=E.useCallback(P=>{vt(null),yt(!1),Ys(null),pn(!0),ts(""),vu("basic"),vs(P.id),Be("")},[]),aB=E.useCallback(async P=>{if(!P.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const Y=(kl==null?void 0:kl.region)??"cn-beijing",ae=await Od(P.runtimeId,P.agentName,P.region??Y,P.version);go(os()),kh(de=>{const Se=new Set(de??[]);return Se.add(P.runtimeId),Se}),xi(null),W0($r),Ks(""),ws.current=null,ts(ae),vu("basic"),vt(null),pn(!0),r(ae)},[$r,W0,kl]),Nu=E.useRef(null),Q0=E.useRef(new Map),yo=E.useRef(!0),ka=E.useRef(!1),bo=E.useRef(null),Y_=E.useRef({key:"",turnCount:0}),Z0=(p==null?void 0:p.id)??a;E.useLayoutEffect(()=>{const P=Nu.current,Y=Y_.current,ae=Y.key!==Z0,de=!ae&&L.length>Y.turnCount;if(Y_.current={key:Z0,turnCount:L.length},!P||L.length===0||!ae&&!de)return;yo.current=!0,ka.current=!1,bo.current!==null&&(window.clearTimeout(bo.current),bo.current=null);const Se=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ae||Se){P.scrollTop=P.scrollHeight;return}ka.current=!0,P.scrollTo({top:P.scrollHeight,behavior:"smooth"}),bo.current=window.setTimeout(()=>{ka.current=!1,bo.current=null},450)},[Z0,L.length]),E.useLayoutEffect(()=>{const P=Nu.current;!P||!yo.current||ka.current||(P.scrollTop=P.scrollHeight)},[xs,L]),E.useEffect(()=>{if(!vh||H0||L.length===0)return;const P=Q0.current.get(vh);if(!P)return;yo.current=!1,P.scrollIntoView({behavior:"smooth",block:"center"});const Y=window.setTimeout(()=>{_h("")},2600);return()=>window.clearTimeout(Y)},[vh,H0,L]),E.useEffect(()=>()=>{bo.current!==null&&window.clearTimeout(bo.current)},[]);const oB=E.useCallback(()=>{const P=Nu.current;!P||ka.current||(yo.current=P.scrollHeight-P.scrollTop-P.clientHeight<32)},[]),lB=E.useCallback(P=>{P.deltaY<0&&(ka.current=!1,yo.current=!1)},[]),cB=E.useCallback(()=>{ka.current=!1,yo.current=!1},[]),uB=E.useCallback(()=>{const P=Nu.current;!P||!yo.current||ka.current||(P.scrollTop=P.scrollHeight)},[]),J0=E.useCallback(()=>{ve(null),uE().then(P=>{nt(P.userId),ct(P.info),Cn(!!P.local),zt(P.status),P.status==="authenticated"&&(vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Cr(!0))}).catch(P=>{ve(P instanceof Error?P.message:String(P))})},[]);E.useEffect(()=>{J0()},[J0]),E.useEffect(()=>{const P=()=>{Mn(""),qt(!0)};return window.addEventListener(dE,P),nV()&&P(),()=>window.removeEventListener(dE,P)},[]);const dB=E.useCallback(async()=>{if(ue.current)return;ue.current=!0;const P=qz();if(!P){ue.current=!1,Mn("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}Xt(!0),Mn("");try{for(;;){await new Promise(Y=>window.setTimeout(Y,1e3));try{const Y=await uE();if(Y.status==="authenticated"){nt(Y.userId),ct(Y.info),Cn(!!Y.local),zt(Y.status),qt(!1),rV(),P.close();return}}catch{}if(P.closed){Mn("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{ue.current=!1,Xt(!1)}},[]);E.useEffect(()=>{Mt&&ye&&US(ye)},[Mt,ye]),E.useEffect(()=>{if(Ht!=="authenticated"||!ye){K({});return}let P=!1;return Promise.allSettled([Kye(),Yye()]).then(([Y,ae])=>{P||K({temporaryEnabled:Y.status==="fulfilled"&&Y.value.enabled,skillCreateEnabled:ae.status==="fulfilled"&&ae.value.enabled})}),()=>{P=!0}},[Ht,ye]),E.useEffect(()=>{if(Ht!=="authenticated"||!ye){oe(null);return}let P=!1;return oe(null),MM().then(Y=>{P||oe(Y)}).catch(Y=>{console.warn("[app] /web/access failed; using ordinary-user access:",Y),P||oe(LM)}),()=>{P=!0}},[Ht,ye]),E.useEffect(()=>{OM().then(P=>{It(P.features),kt(P.agentsSource),Zn(P.branding),lr(P.version),Zt(P.defaultView),Jt(!0)})},[]),E.useEffect(()=>{!ot||!Yt||Sh.current||_u||(Sh.current=!0,dn==="addAgent"&&ot.capabilities.createAgents&&(vt(null),pt(!1),Hr(!1),pn(!1),lt(!1),yt(!0)))},[ot,dn,_u,Yt]),E.useEffect(()=>{ot&&(ot.capabilities.createAgents||(vt(null),Rt(null),lt(!1),yt(!1),re([])),ot.capabilities.manageAgents||pn(!1))},[ot]),E.useEffect(()=>{Ht!=="authenticated"||it!=="cloud"||!Yt||q0()},[it,Ht,q0,Yt]),E.useEffect(()=>{document.title=Ft.title;let P=document.querySelector('link[rel~="icon"]');P||(P=document.createElement("link"),P.rel="icon",document.head.appendChild(P)),P.removeAttribute("type"),P.href=Ft.logoUrl||mv},[Ft]),E.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(P=>P.ok?P.json():null).then(P=>{P&&Re(!!P.credentials)}).catch(P=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",P)})},[]);function fB(P){US(P),G0.current=!0,Sh.current=!1,oe(null),vt(null),Rt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),xo(),Cr(!0),nt(P),ct({name:P}),Cn(!0),zt("authenticated")}function hB(){Sh.current=!1,oe(null),Mt?(Gz(),nt(""),ct(void 0),zt("unauthenticated")):Qz()}E.useEffect(()=>{Ht!=="unauthenticated"&&mM().then(P=>{if(t(P),it==="cloud"){const xe=localStorage.getItem(Io.app),Me=ku.flatMap(Ke=>Ke.apps.map(Pe=>Ja(Ke.id,Pe)));r(Ke=>Ke&&Me.includes(Ke)?Ke:xe&&Me.includes(xe)?xe:Me[0]??"");return}const Y=localStorage.getItem(Io.app),ae=ku.flatMap(xe=>xe.apps.map(Me=>Ja(xe.id,Me))),de=Y&&(P.includes(Y)||ae.includes(Y)),Se=["web_search_agent","web_demo"].find(xe=>P.includes(xe))??P.find(xe=>!/^\d/.test(xe))??P[0];r(de?Y:Se||"")}).catch(P=>Be(String(P)))},[Ht,it,ku]),E.useEffect(()=>{n&&localStorage.setItem(Io.app,n)},[n]),E.useEffect(()=>{let P=!1;if(Ie(null),Ge([]),!n||!ye||!a){Ce(!1);return}return Ce(!0),_M(n,ye,a).then(Y=>{P||(Ie(Y),kM(n).then(ae=>{P||Ge(ae)}).catch(()=>{P||Ge([])}))}).catch(()=>{P||Ie(null)}).finally(()=>{P||Ce(!1)}),()=>{P=!0}},[n,ye,a]),E.useEffect(()=>{let P=!1;if(we(null),te(Xi()),!n){me(!1);return}return me(!0),fv(n).then(Y=>{P||we(Y)}).catch(()=>{P||we(null)}).finally(()=>{P||me(!1)}),()=>{P=!0}},[n]),E.useEffect(()=>{ot&&localStorage.setItem(Io.view,ot.capabilities.createAgents?Vs??"chat":"chat")},[ot,Vs]),E.useEffect(()=>{localStorage.setItem(Io.session,a),Ye.current=a},[a]),E.useEffect(()=>()=>he.current.forEach(P=>P.abort()),[]),E.useEffect(()=>()=>Te.current.forEach(P=>{window.clearTimeout(P)}),[]),E.useEffect(()=>()=>{var P,Y;(P=C.current)==null||P.abort(),(Y=R.current)==null||Y.abort()},[]),E.useEffect(()=>{!n||!ye||(async()=>{const P=await Ah(n);if(!G0.current){G0.current=!0;const Y=localStorage.getItem(Io.session)||"";if(qC()===null&&Y&&P.some(ae=>ae.id===Y)){Su(Y);return}}xo()})()},[n,ye]),E.useEffect(()=>{const P=V0.current;P&&P.app===n&&(V0.current=null,Su(P.sid))},[n]);function pB(P,Y){Hr(!1),P===n?Su(Y):(V0.current={app:P,sid:Y},r(P))}async function Ah(P){try{const Y=await cv(P,ye),ae=await Promise.all(Y.map(de=>{var Se;return(Se=de.events)!=null&&Se.length?Promise.resolve(de):Km(P,ye,de.id)}));return i(ae),ae}catch(Y){return Be(String(Y)),[]}}function G_(){p||(Be(""),S(""),N("confirm"),_(!0))}function mB(){var P;(P=C.current)==null||P.abort(),C.current=null,_(!1),N("confirm"),S(""),!p&&j==="temporary"&&U("agent")}async function gB(){var Y;(Y=C.current)==null||Y.abort();const P=new AbortController;C.current=P,N("loading"),S("");try{const ae=await Gb.startSession({signal:P.signal});if(C.current!==P)return;Ye.current="",o(""),h([]),M(""),te(Xi()),U("temporary"),wa(),Q(!1),xa(ce),J([]),x([]),m(ae),vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),_(!1),N("confirm")}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||C.current!==P)return;S(ae instanceof Error?ae.message:String(ae)),N("error")}finally{C.current===P&&(C.current=null)}}function Eo(){var Y;(Y=R.current)==null||Y.abort(),R.current=null,w(!1),x([]),M(""),Be(""),U("agent");const P=p;m(null),P&&Gb.closeSession(P.id).catch(ae=>Be(String(ae)))}async function yB(P){var Se;const Y=p;if(!Y||y||!P.trim())return;Be("");const ae=new AbortController;(Se=R.current)==null||Se.abort(),R.current=ae;const de=[{role:"user",blocks:[{kind:"text",text:P}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];x(xe=>[...xe,...de]),w(!0);try{const xe=await Gb.sendMessage({sessionId:Y.id,text:P},{signal:ae.signal,onBlocks:Me=>{R.current===ae&&x(Ke=>{const Pe=Ke.slice(),jt=Pe[Pe.length-1];return(jt==null?void 0:jt.role)==="assistant"&&(Pe[Pe.length-1]={...jt,blocks:Me}),Pe})}});if(R.current!==ae)return;x(Me=>{const Ke=Me.slice(),Pe=Ke[Ke.length-1];return(Pe==null?void 0:Pe.role)==="assistant"&&(Ke[Ke.length-1]={...Pe,blocks:xe.blocks,meta:{ts:Date.now()/1e3}}),Ke})}catch(xe){if((xe==null?void 0:xe.name)==="AbortError"||R.current!==ae)return;x(Me=>Me.slice(0,-2)),M(P),Be(`内置智能体发送失败:${xe instanceof Error?xe.message:String(xe)}`)}finally{R.current===ae&&(R.current=null,w(!1))}}function xo(){Eo(),Be(""),be(!1),an(JC()),U("agent"),wa(),Q(!1);const P=a&&q.length===0&&ce.length>0?a:"";Ye.current="",o(""),Ie(null),Ge([]),d(!1),h([]),te(Xi()),xa(ce),J([]),P&&va(P)}function bB(P){$t.current!==null&&window.clearTimeout($t.current),un(P),$t.current=window.setTimeout(()=>{un(""),$t.current=null},3e3)}function EB(){if(vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),!n&&!p){Cr(!0),bB("请先选择 agent");return}Cr(!1),xo()}async function xB(P){var Y;try{(Y=he.current.get(P))==null||Y.abort(),await hE(n,ye,P),await fE(n,ye,P);const ae=Te.current.get(P);ae!==void 0&&window.clearTimeout(ae),Te.current.delete(P),ne(de=>{if(!de.has(P))return de;const Se=new Set(de);return Se.delete(P),Se}),F(de=>{const{[P]:Se,...xe}=de;return xe}),P===a&&xo(),await Ah(n)}catch(ae){Be(String(ae))}}async function Su(P){if(p&&Eo(),P!==a&&(Ye.current=P,Be(""),d(!1),h([]),U("agent"),wa(),te(Xi()),Ie(null),Ge([]),o(P),O[P]===void 0)){en(!0);try{const Y=await Km(n,ye,P);D(P,vV(Y.events??[],Y.state))}catch(Y){Be(String(Y))}finally{en(!1)}}}async function wB(P){if(!P.sessionId||!P.messageId){Be("这条案例缺少会话定位信息,无法跳转。");return}Hr(!1),vt(null),lt(!1),yt(!1),pt(!1),pn(!1),z0(n),G5(P.kind),_h(P.messageId),await Su(P.sessionId)}function vB(){const P=U_||n;Hr(!1),vt(null),lt(!1),yt(!1),pt(!1),vs(""),ts(P),vu("evaluations"),X5(Y5),pn(!0),z0(""),_h("")}function _B(P){const Y=new Map,ae=new Map;for(const de of P){if(!de.sessionId||!de.messageId)continue;const Se=Y.get(de.sessionId)??new Set;if(Se.add(de.messageId),Y.set(de.sessionId,Se),de.runtimeId&&de.userId){const xe=[de.runtimeId,n,de.userId,de.sessionId].join(":"),Me=ae.get(xe)??{runtimeId:de.runtimeId,appName:n,userId:de.userId,sessionId:de.sessionId,eventIds:new Set};Me.eventIds.add(de.messageId),ae.set(xe,Me)}}if(Y.size!==0){F(de=>{const Se={...de};for(const[xe,Me]of Y){const Ke=Se[xe];Ke&&(Se[xe]=Ke.map(Pe=>{var jt;return(jt=Pe.meta)!=null&&jt.eventId&&Me.has(Pe.meta.eventId)?{...Pe,meta:{...Pe.meta,feedback:void 0}}:Pe}))}return Se}),i(de=>de.map(Se=>{const xe=Y.get(Se.id);if(!xe||!Se.state)return Se;const Me={...Se.state};for(const Ke of xe)delete Me[`veadk_feedback:${Ke}`];return{...Se,state:Me}})),Fe(de=>{const Se=new Set(de);for(const xe of Y.values())for(const Me of xe)Se.delete(Me);return Se});for(const de of ae.values())fM({runtimeId:de.runtimeId,appName:de.appName,userId:de.userId,sessionId:de.sessionId,eventIds:[...de.eventIds]})}}async function W_(P=!0){if(a)return a;c.current||(c.current=Vm(n,ye));const Y=c.current;try{const ae=await Y;P&&o(ae);const de=Date.now()/1e3,Se={id:ae,lastUpdateTime:de,events:[]};return i(xe=>[Se,...xe.filter(Me=>Me.id!==ae)]),ae}finally{c.current===Y&&(c.current=null)}}async function q_(P){if(!n||!ye||!a||!Ne)return!1;xt(!0),Be("");try{const Y=await SM(n,ye,a,P,Ne.revision);return Ie(Y),!0}catch(Y){return Be(String(Y)),!1}finally{xt(!1)}}async function X_(P){if(!(!n||!ye||!a||!Ne)){xt(!0),Be("");try{const Y=await TM(n,ye,a,P,Ne.revision);Ie(Y)}catch(Y){Be(String(Y))}finally{xt(!1)}}}async function kB(P){Be("");let Y;try{Y=await W_()}catch(de){Be(String(de));return}const ae=Array.from(P).map(de=>({file:de,attachment:{id:Obe(),mimeType:Lbe(de),name:de.name,sizeBytes:de.size,status:"uploading"}}));J(de=>[...de,...ae.map(Se=>Se.attachment)]),await Promise.all(ae.map(async({file:de,attachment:Se})=>{try{const xe=await EM(n,ye,Y,de);if(gt.current.delete(Se.id)){xe.uri&&await Gp(n,xe.uri);return}J(Me=>Me.map(Ke=>Ke.id===Se.id?xe:Ke))}catch(xe){if(gt.current.delete(Se.id))return;const Me=xe instanceof Error?xe.message:String(xe);J(Ke=>Ke.map(Pe=>Pe.id===Se.id?{...Pe,status:"error",error:Me}:Pe)),Be(Me)}}))}async function Q_(P,Y=[],ae=Xi()){if(!P.trim()&&Y.length===0||bi||po||!n||!ye)return;Be("");const de=[];(ae.skills.length>0||ae.targetAgent)&&de.push({kind:"invocation",value:ae}),Y.length&&de.push({kind:"attachment",files:Y.map(Pe=>({id:Pe.id,mimeType:Pe.mimeType,data:Pe.data,uri:Pe.uri,name:Pe.name,sizeBytes:Pe.sizeBytes}))}),P.trim()&&de.push({kind:"text",text:P});const Se=[{role:"user",blocks:de,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],xe=!a;xe&&(h(Se),d(!0));let Me;try{Me=await W_(!xe)}catch(Pe){xe&&(h([]),d(!1),M(P),te(ae)),Be(String(Pe));return}D(Me,Pe=>xe?Se:[...Pe,...Se]),xe&&(Ye.current=Me,o(Me),h([]),d(!1));const Ke=new AbortController;he.current.set(Me,Ke),He(Me,!0),qe(Me),Ye.current=Me,hn(Pe=>({...Pe,[Me]:""})),Kn(Pe=>({...Pe,[Me]:new Set})),yr(Pe=>({...Pe,[Me]:[]}));try{let Pe=si(),jt="",tt=0,ft=Date.now()/1e3,_n="",rs="";for await(const In of bf({appName:n,userId:ye,sessionId:Me,text:P,attachments:Y,invocation:ae,signal:Ke.signal,sessionCapabilities:Ne!==null})){if(Ke.signal.aborted)break;const Vi=In.error??In.errorMessage??In.error_message;if(typeof Vi=="string"&&Vi){Ye.current===Me&&Be(Vi);break}_a(Me,In);const Ki=In.author&&In.author!=="user"?In.author:"";Ki&&Ki!==jt&&(jt=Ki,Pe=si()),Pe=Dc(Pe,In);const wi=In.usageMetadata??In.usage_metadata;wi!=null&&wi.totalTokenCount&&(tt=wi.totalTokenCount),In.timestamp&&(ft=In.timestamp),In.id&&(_n=In.id);const Gn=In.invocationId??In.invocation_id;Gn&&(rs=Gn);const Ir=Pe.blocks,vi={author:jt||void 0,tokens:tt||void 0,ts:ft,eventId:_n||void 0,invocationId:rs||void 0};D(Me,Yi=>{var Gi;const dr=Yi.slice(),Na=dr[dr.length-1];return(Na==null?void 0:Na.role)==="assistant"&&(!((Gi=Na.meta)!=null&&Gi.author)||Na.meta.author===jt)?dr[dr.length-1]={...Na,blocks:Ir,meta:vi}:dr.push({role:"assistant",blocks:Ir,meta:vi}),dr})}Ah(n)}catch(Pe){(Pe==null?void 0:Pe.name)!=="AbortError"&&!Ke.signal.aborted&&Ye.current===Me&&Be(String(Pe))}finally{he.current.get(Me)===Ke&&he.current.delete(Me),He(Me,!1),Ut(Me),hn(Pe=>({...Pe,[Me]:""})),yr(Pe=>({...Pe,[Me]:[]}))}}function NB(P,Y){var Se,xe;const ae=((Se=P==null?void 0:P.event)==null?void 0:Se.name)??Y.id,de=((xe=P==null?void 0:P.event)==null?void 0:xe.context)??{};Q_(`[ui-action] ${ae}: ${JSON.stringify(de)}`)}async function SB(P){var Pe,jt,tt;if(!P.authUri)throw new Error("事件中没有授权地址。");if(!n||!ye||!a)throw new Error("会话尚未就绪。");const Y=a,ae=await Abe(P.authUri),de=Cbe(P.authConfig,ae),Se=ft=>ft.map(_n=>_n.kind==="auth"&&!_n.done?{..._n,done:!0}:_n);D(Y,ft=>{const _n=ft.slice(),rs=_n[_n.length-1];return(rs==null?void 0:rs.role)==="assistant"&&(_n[_n.length-1]={...rs,blocks:Se(rs.blocks)}),_n});const xe=L[L.length-1],Me=Se(xe&&xe.role==="assistant"?xe.blocks:[]),Ke=new AbortController;he.current.set(Y,Ke),He(Y,!0),qe(Y);try{let ft=si(),_n=((Pe=xe==null?void 0:xe.meta)==null?void 0:Pe.author)??"",rs=Me,In=0,Vi=Date.now()/1e3,Ki=((jt=xe==null?void 0:xe.meta)==null?void 0:jt.eventId)??"",wi=((tt=xe==null?void 0:xe.meta)==null?void 0:tt.invocationId)??"";for await(const Gn of bf({appName:n,userId:ye,sessionId:a,text:"",functionResponses:[{id:P.callId,name:"adk_request_credential",response:de}],signal:Ke.signal,sessionCapabilities:Ne!==null})){if(Ke.signal.aborted)break;_a(Y,Gn);const Ir=Gn.author&&Gn.author!=="user"?Gn.author:"";Ir&&Ir!==_n&&(_n=Ir,rs=[],ft=si()),ft=Dc(ft,Gn);const vi=Gn.usageMetadata??Gn.usage_metadata;vi!=null&&vi.totalTokenCount&&(In=vi.totalTokenCount),Gn.timestamp&&(Vi=Gn.timestamp),Gn.id&&(Ki=Gn.id);const Yi=Gn.invocationId??Gn.invocation_id;Yi&&(wi=Yi);const dr=[...rs,...ft.blocks];D(Y,Na=>{var rk,sk,ik,ak,ok;const Gi=Na.slice(),tr=Gi[Gi.length-1],nk={author:_n||((rk=tr==null?void 0:tr.meta)==null?void 0:rk.author),tokens:In||((sk=tr==null?void 0:tr.meta)==null?void 0:sk.tokens),ts:Vi,eventId:Ki||((ik=tr==null?void 0:tr.meta)==null?void 0:ik.eventId),invocationId:wi||((ak=tr==null?void 0:tr.meta)==null?void 0:ak.invocationId)};return(tr==null?void 0:tr.role)==="assistant"&&(!((ok=tr.meta)!=null&&ok.author)||tr.meta.author===_n)?Gi[Gi.length-1]={...tr,blocks:dr,meta:nk}:Gi.push({role:"assistant",blocks:dr,meta:nk}),Gi})}Ah(n)}catch(ft){(ft==null?void 0:ft.name)!=="AbortError"&&!Ke.signal.aborted&&Ye.current===Y&&Be(String(ft))}finally{he.current.get(Y)===Ke&&he.current.delete(Y),He(Y,!1),Ut(Y),hn(ft=>({...ft,[Y]:""})),yr(ft=>({...ft,[Y]:[]}))}}if(_e)return l.jsxs("div",{className:"boot boot-error",children:[l.jsx("p",{children:_e}),l.jsx("button",{type:"button",onClick:J0,children:"重试"})]});if(Ht===null)return l.jsx("div",{className:"boot"});if(Ht==="unauthenticated")return l.jsx(rbe,{branding:Ft,onUsername:fB});if(!ot)return l.jsx("div",{className:"boot"});const Gs=ot.capabilities.createAgents,Z_=ot.capabilities.manageAgents,ks=Gs?Vs:null,Tu=Gs&&Yn,Au=Gs&&at,Cu=H0,J_=qM(e,ku),Iu=J_.filter(P=>P.runtimeId&&(H_===null||H_.has(P.runtimeId))).map(P=>{var Y;return{...P,canDelete:P.runtimeId?((Y=J5[P.runtimeId])==null?void 0:Y.canDelete)===!0:!1}}),TB=(()=>{if(Iu.length===0)return Iu;const P=new Map(_l.map((Y,ae)=>[Y,ae]));return[...Iu].sort((Y,ae)=>{const de=P.get(Y.id),Se=P.get(ae.id);return de!=null&&Se!=null?de-Se:de!=null?-1:Se!=null?1:Iu.indexOf(Y)-Iu.indexOf(ae)})})(),Ch=P=>{var Y;return((Y=J_.find(ae=>ae.id===P))==null?void 0:Y.label)??P},ns=ku.find(P=>P.runtimeId&&P.apps.some(Y=>Ja(P.id,Y)===n)),Nl=ns&&ns.runtimeId?{runtimeId:ns.runtimeId,name:ns.name,region:ns.region??"cn-beijing"}:void 0,ek=async(P,Y)=>{var Me,Ke;const ae=(Me=P.meta)==null?void 0:Me.eventId,de=a;if(!ae||!de||!Nl)return;const Se=(Ke=P.meta)==null?void 0:Ke.feedback,xe={...Se,rating:Y,syncStatus:"syncing",updatedAt:Date.now()/1e3};D(de,Pe=>Pe.map(jt=>{var tt;return((tt=jt.meta)==null?void 0:tt.eventId)===ae?{...jt,meta:{...jt.meta,feedback:xe}}:jt})),Fe(Pe=>new Set(Pe).add(ae));try{const Pe=await gM({appName:n,userId:ye,sessionId:de,eventId:ae,rating:Y});D(de,jt=>jt.map(tt=>{var ft;return((ft=tt.meta)==null?void 0:ft.eventId)===ae?{...tt,meta:{...tt.meta,feedback:Pe}}:tt})),i(jt=>jt.map(tt=>tt.id===de?{...tt,state:{...tt.state??{},[`veadk_feedback:${ae}`]:Pe}}:tt))}catch(Pe){D(de,jt=>jt.map(tt=>{var ft;return((ft=tt.meta)==null?void 0:ft.eventId)===ae?{...tt,meta:{...tt.meta,feedback:Se}}:tt})),Ye.current===de&&Be(Pe instanceof Error?Pe.message:String(Pe))}finally{Fe(Pe=>{const jt=new Set(Pe);return jt.delete(ae),jt})}},Ih=P=>{go(os()),Ye.current="",o(""),Cr(!1),r(P)},AB=()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}Cr(!1),pn(!1),Rt(null),vt(null),yt(!0),Be("")},CB=async P=>{if(P.runtime)try{const Y=await Od(P.runtime.runtimeId,P.name,P.runtime.region,P.runtime.currentVersion);go(os()),Ys(null),Cr(!1),pn(!1),xo(),r(Y)}catch(Y){Be(Y instanceof Error?Y.message:String(Y))}},IB=P=>{P.runtime&&(Ys(P),vs(""),ts(""),Cr(!1),pn(!0),Be(""))},tk=()=>{p&&Eo(),Ye.current="",o(""),vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),vs(""),ts(""),Cr(!0),Be("")},RB=P=>{z0(""),_h(""),Ih(P)},OB=P=>{vs(""),ts(P),vu("basic"),Ih(P)},zi=_s!=null&&_s.runtime?{id:`detail:${_s.runtime.runtimeId}`,label:_s.name,app:_s.name,remote:!0,runtimeId:_s.runtime.runtimeId,region:_s.runtime.region,currentVersion:_s.runtime.currentVersion,canDelete:_s.runtime.canDelete}:null;return l.jsxs("div",{className:"layout",children:[l.jsx(HV,{branding:Ft,access:ot,features:Ze,sessions:s,currentSessionId:a,streamingSids:At,onNewChat:EB,onSearch:()=>{p&&Eo(),vt(null),pt(!1),lt(!1),yt(!1),pn(!1),Ys(null),Cr(!1),Hr(!0),Be("")},onQuickCreate:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}p&&Eo(),Ye.current="",o(""),pt(!1),lt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),vt(null),Rt(null),yt(!0),Be("")},onSkillCenter:()=>{p&&Eo(),vt(null),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),pt(!0),Be("")},onAddAgent:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}p&&Eo(),Ye.current="",vt(null),pt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),o(""),yt(!1),lt(!0),Be("")},onMyAgents:tk,onPickSession:P=>{vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),Be(""),Su(P)},onDeleteSession:xB,userInfo:Qe,version:or,onLogout:hB}),(()=>{const P=l.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&l.jsx(qye,{onExit:xo}),l.jsx(hme,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?Ch(n):"Agent",value:T,onChange:M,onSubmit:()=>{if(!p&&j==="skill-create"){const Se=T.trim();if(!Se||ie)return;const xe={id:`pending-${Date.now()}`,prompt:Se,status:"provisioning",candidates:x_.map((Ke,Pe)=>({id:`pending-${Pe}`,model:Ke,modelLabel:Ke,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};Q(!0);const Me=++ee.current;Be(""),B(xe),M(""),kye(Se,Ke=>{ee.current===Me&&B(Ke)}).then(Ke=>{ee.current===Me&&B(Ke)}).catch(Ke=>{ee.current===Me&&(B(null),M(Se),Be(Ke instanceof Error?Ke.message:String(Ke)))}).finally(()=>{ee.current===Me&&Q(!1)});return}const Y=T;if(M(""),p){yB(Y);return}const ae=ce,de=fe;J([]),te(Xi()),Q_(Y,ae,de),Xb(ae)},disabled:p?!1:!ye||j==="temporary"||j==="agent"&&!n,busy:p?y:j==="skill-create"?ie:bi,showMeta:L.length>0&&!p,attachments:p?[]:ce,skills:p?[]:wl,agents:p?[]:vl,invocation:p?Xi():fe,capabilitiesLoading:!p&&Z,allowAttachments:!p,onInvocationChange:te,onAddFiles:kB,onRemoveAttachment:mo,newChatMode:p?"agent":j,newChatLayout:!p&&L.length===0&&W===null,showModeSelector:!1,temporaryEnabled:I.temporaryEnabled,skillCreateEnabled:I.skillCreateEnabled,onModeChange:Y=>{if(!(Y==="temporary"&&!I.temporaryEnabled||Y==="skill-create"&&!I.skillCreateEnabled)){if(Y==="temporary"){U(Y),G_();return}if(U(Y),Be(""),Y==="skill-create"){te(Xi());const ae=a&&q.length===0&&ce.length>0?a:"";xa(ce),J([]),ae&&(Ye.current="",o(""),va(ae))}}}})]});return l.jsxs("section",{className:"main-shell",children:[l.jsx(rK,{appName:n,onAppChange:Cu?OB:Ih,agentLabel:Ch,agentsSource:it,localApps:e,currentRuntime:Nl,runtimeScope:ot.capabilities.runtimeScope,onBrowseAgents:tk,title:p?"Codex 智能体":_u?"智能体":Tu?"添加 Agent":Au?"添加 AgentKit 智能体":Cu?_s?_s.name:Y0?Ch(Y0):"智能体详情":void 0,titleLeading:L.length>0&&!p&&j==="agent"&&!Tu&&!Au&&!$e&&!wh&&!Cu&&!_u&&ks===null&&n?l.jsx("button",{ref:Ve,type:"button",className:"agent-info-trigger","aria-label":"查看 Agent 信息",title:"Agent 信息","aria-expanded":_t,onClick:()=>be(!0),children:l.jsx(Pc,{})}):void 0,crumbs:$e?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:wh||Au||Tu||!ks?void 0:ks==="menu"?[{label:gbe,onClick:()=>{vt(null),Rt(null),yt(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>Nh(!0)},{label:ybe[ks]}],rightContent:l.jsxs(l.Fragment,{children:[ot.role==="admin"&&l.jsx(gye,{}),l.jsx(Rbe,{tasks:Gs?z:[],onCancel:$})]})}),l.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[De&&l.jsx("div",{className:"error",children:De}),fn&&l.jsxs("div",{className:"session-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载会话…"]}),U_&&!Cu&&!Tu&&!Au&&!wh&&!$e&&ks===null&&l.jsx("div",{className:"case-return-bar",children:l.jsxs("button",{type:"button",onClick:vB,children:[l.jsx(qw,{"aria-hidden":!0}),l.jsx("span",{children:"返回评测案例"})]})}),_u?l.jsx(Npe,{onCreateAgent:AB,onCreateCodexAgent:G_,onUseAgent:CB,onViewAgentDetails:IB,connectedRuntimeId:Nl==null?void 0:Nl.runtimeId}):Cu?l.jsx(ype,{agents:zi?[zi]:TB,drafts:cr,agentOrder:_l,selectedAgentId:n,agentInfo:ge,agentInfoAgentId:n,loadingAgentInfo:Z,canCreate:Gs,canUpdate:Gs||Z_,loadingAgents:Q5,agentsError:Z5,deploymentTasks:z,focusedDeploymentTaskId:V_,focusedAgentId:(zi==null?void 0:zi.id)??Y0,focusedAgentSection:W5,focusedCaseKind:q5,detailOnly:!!zi||!!V_,onRetryAgents:()=>void q0(),onAgentOrderChange:rB,onDeleteAgents:sB,onDeleteDrafts:nB,onSelectAgent:Ih,onTalkAgent:RB,onOpenFeedbackCase:Y=>void wB(Y),onFeedbackCasesDeleted:_B,onCreateAgent:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}pn(!1),yt(!0),vt(null),Rt(null),xi(null),Ks(""),ws.current=null,vs(""),ts(""),Be("")},onUpdateAgent:Y=>{if(!Z_&&!Gs){Be("当前账号没有管理 Agent 的权限。");return}if(!(ns!=null&&ns.runtimeId)){Be("仅支持更新已部署的云端智能体。");return}pn(!1),Rt(Y);const ae=`runtime-${ns.runtimeId}`;Ks(ae),ws.current=cr.find(de=>de.id===ae)??null,vs(""),ts(""),xi({runtimeId:ns.runtimeId,name:ns.name,region:ns.region??"cn-beijing",currentVersion:ns.currentVersion}),vt("custom"),Be("")},onEditDraft:Y=>{pn(!1),Rt(Y.draft),Ks(Y.id),ws.current=Y,xi(Y.deploymentTarget??null),vs(""),ts(""),vt("custom"),Be("")}},(zi==null?void 0:zi.id)??"workspace"):Tu?l.jsx(_6,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:vbe,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{yt(!1),Rt(null),vt("menu")}},{key:"package",icon:dz,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{yt(!1),Rt(null),vt("package")}}]}):wh?l.jsx(jV,{userId:ye,appId:n,agentInfo:ge,capabilitiesLoading:Z,agentLabel:Ch,onOpenSession:pB}):Au?l.jsx(rse,{onAdded:Y=>{go(os()),lt(!1),r(Y)},onCancel:()=>lt(!1)}):$e?l.jsx(nse,{}):ks!==null&&!le?l.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:[l.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),l.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",l.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",l.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):ks==="menu"?l.jsx(Cge,{onSelect:Y=>{Rt(null),xi(null),vs(""),ts(""),Ks(Y==="custom"?`draft-${Date.now().toString(36)}`:""),ws.current=null,vt(Y)},onImport:Y=>{Rt(Y),xi(null),vs(""),ts(""),Ks(`draft-${Date.now().toString(36)}`),ws.current=null,vt("custom")}}):ks==="intelligent"?l.jsx(e0e,{userId:ye,onBack:()=>vt("menu"),onCreate:Th,onAgentAdded:X0,onDeploymentTaskChange:Ee}):ks==="custom"?l.jsx(V0e,{initialDraft:er??void 0,onBack:()=>vt("menu"),onCreate:Th,onAgentAdded:X0,features:Ze,onDeploymentTaskChange:Ee,deploymentTarget:kl??void 0,onDraftChange:(Y,ae)=>{$r&&(ae?tB($r,Y,kl??void 0):K_($r))},onDiscard:$r?()=>{K_($r),Ks(""),ws.current=null,Rt(null),xi(null),vs(""),ts(n),vt(null),yt(!1),pn(!0),Be("")}:void 0,onDeploymentStarted:iB,onDeploymentComplete:aB},$r||"custom"):ks==="template"?l.jsx(G0e,{onBack:()=>vt("menu"),onCreate:Th}):ks==="workflow"?l.jsx(tye,{onBack:()=>vt("menu"),onCreate:Th}):ks==="package"?l.jsx(aye,{onBack:()=>{vt(null),yt(!0)},onAgentAdded:X0,onDeploymentTaskChange:Ee}):L.length===0&&W?l.jsx(Fye,{initialJob:W}):L.length===0?l.jsxs("div",{className:"welcome",children:[l.jsx(pa,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":j==="skill-create"?"想创建一个什么 Skill?":sn}),P]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`transcript${Ei?" is-streaming":""}`,ref:Nu,onScroll:oB,onWheel:lB,onTouchMove:cB,children:L.map((Y,ae)=>{var In,Vi,Ki,wi,Gn;const de=ae===L.length-1;if(Y.role==="user"){const Ir=Y.blocks.map(dr=>dr.kind==="text"?dr.text:"").join(""),vi=Y.blocks.flatMap(dr=>dr.kind==="attachment"?dr.files:[]),Yi=Y.blocks.find(dr=>dr.kind==="invocation");return l.jsxs(Wt.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Yi==null?void 0:Yi.kind)==="invocation"&&l.jsx(g_,{value:Yi.value}),vi.length>0&&l.jsx(b_,{appName:n,items:vi}),Ir&&l.jsx("div",{className:"bubble",children:l.jsx(sh,{text:Ir})}),l.jsxs("div",{className:"turn-actions turn-actions--right",children:[((In=Y.meta)==null?void 0:In.ts)&&l.jsx("span",{className:"meta-text",children:K5(Y.meta.ts)}),l.jsx(QC,{text:Ir})]})]},ae)}const Se=((Vi=Y.meta)==null?void 0:Vi.author)??"",xe=Se&&Jn?vx(Jn,Se):void 0,Me=!!(Se&&Ea.length>0&&!Ea.includes(Se)),Ke=(xe==null?void 0:xe.name)||Se,Pe=(xe==null?void 0:xe.description)||(Me?"正在执行主 Agent 移交的任务。":"");if(Y.blocks.length>0&&Y.blocks.every(Ir=>Ir.kind==="agent-transfer"))return null;const jt=Y.blocks.length===0,tt=((wi=(Ki=Y.meta)==null?void 0:Ki.feedback)==null?void 0:wi.rating)??null,ft=((Gn=Y.meta)==null?void 0:Gn.eventId)??"",_n=wn.has(ft),rs=!!(Nl&&ft&&XC(Y));return l.jsxs(Wt.div,{ref:Ir=>{ft&&(Ir?Q0.current.set(ft,Ir):Q0.current.delete(ft))},className:["turn turn--assistant",Me?"turn--subagent":"",vh===ft?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Me&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"subagent-run-label",children:[l.jsxs("span",{className:"subagent-run-handoff",children:[l.jsx(oz,{}),l.jsx("span",{children:"智能体移交"})]}),l.jsx("span",{className:"subagent-run-title",children:Ke})]}),l.jsx("p",{className:"subagent-run-description",title:Pe,children:Pe})]}),jt?de&&xs?l.jsx(w6,{}):null:l.jsxs(l.Fragment,{children:[l.jsx(E_,{appName:n,blocks:Y.blocks,streaming:de&&(xs||Es),onStreamFrame:de?uB:void 0,onAction:NB,onAuth:SB}),!(de&&xs)&&!Sbe(Y)&&l.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(de&&xs)&&!Tbe(Y)&&l.jsxs("div",{className:"turn-meta",children:[l.jsxs("div",{className:"turn-actions",children:[rs&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`icon-btn feedback-btn${tt==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":tt==="good","aria-busy":_n,title:tt==="good"?"取消点赞":"赞",disabled:_n,onClick:()=>void ek(Y,tt==="good"?null:"good"),children:l.jsx(Xye,{className:"icon",filled:tt==="good"})}),l.jsx("button",{type:"button",className:`icon-btn feedback-btn${tt==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":tt==="bad","aria-busy":_n,title:tt==="bad"?"取消点踩":"踩",disabled:_n,onClick:()=>void ek(Y,tt==="bad"?null:"bad"),children:l.jsx(Qye,{className:"icon",filled:tt==="bad"})})]}),!p&&l.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>Lt(!0),children:l.jsx(_be,{})}),l.jsx(QC,{text:XC(Y)})]}),Y.meta&&l.jsx("span",{className:"meta-text",children:kbe(Y.meta)})]})]})]},ae)})}),!p&&l.jsx(o3,{appName:n,info:ge,loading:Z,activeAgent:$i,seenAgents:Ur,execPath:Ar,capabilities:Ne,capabilityLoading:We,capabilityMutating:Xe,builtinTools:et,onAddCapability:q_,onRemoveCapability:Y=>void X_(Y)}),l.jsx("div",{className:"conversation-composer-slot",children:P})]})]})]})})(),dt&&a&&l.jsx(tbe,{appName:n,sessionId:a,onClose:()=>Lt(!1)}),_t&&L.length>0&&l.jsx(wK,{appName:n,info:ge,loading:Z,activeAgent:$i,seenAgents:Ur,execPath:Ar,capabilities:Ne,capabilityLoading:We,capabilityMutating:Xe,builtinTools:et,onAddCapability:q_,onRemoveCapability:P=>void X_(P),onClose:st,returnFocusRef:Ve}),l.jsx(Wye,{open:b,state:k,error:A,onCancel:mB,onConfirm:()=>void gB()}),Ct&&l.jsx("div",{className:"app-toast",role:"status","aria-live":"polite",children:Ct}),l.jsx(sbe,{open:Bt,checking:vn,error:Ln,onLogin:()=>void dB()}),eB&&l.jsx("div",{className:"confirm-scrim",onClick:()=>Nh(!1),children:l.jsxs("div",{className:"confirm-box",onClick:P=>P.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),l.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{className:"confirm-btn",onClick:()=>Nh(!1),children:"取消"}),l.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{Rt(null),vt("menu"),Nh(!1)},children:"确定返回"})]})]})})]})}const eI="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(eI)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(eI,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})()||Qb.createRoot(document.getElementById("root")).render(l.jsx(wt.StrictMode,{children:l.jsx(y9,{reducedMotion:"user",children:l.jsx(XH,{maskOpacity:.9,children:l.jsx(Mbe,{})})})}));export{E as A,o0 as B,fs as C,Fbe as D,Ld as E,sl as F,X3 as G,Dbe as R,Sr as V,wt as a,$c as b,KT as c,Ube as d,vv as e,AW as f,vf as g,Dt as h,KX as i,ZX as j,IW as k,Bf as l,ZQ as m,LX as n,MX as o,aZ as p,SQ as q,TQ as r,oj as s,l as t,Je as u,Qt as v,St as w,Bbe as x,zX as y,Us as z}; +`)),m("copied")}catch{m("error")}},F=()=>{var D;h(!1),m("idle"),c(""),d(w.current||((D=N[0])==null?void 0:D.version)||""),s("confirm")};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`studio-update-trigger is-${r}`,title:r==="submitting"?"正在更新 Studio":r==="published"?"Studio 已更新":`更新 Studio 至 ${t.latestVersion}`,onClick:()=>{var D;r==="published"?window.location.reload():(r==="submitting"||r==="error"||(d(((D=N[0])==null?void 0:D.version)||t.latestVersion),s("confirm")),a(!0))},children:[l.jsx($C,{className:"studio-update-icon"}),r==="submitting"?l.jsx(pa,{as:"span",children:"正在更新"}):r==="published"?l.jsx("span",{children:"刷新使用新版"}):r==="error"?l.jsx("span",{children:"更新失败"}):l.jsx("span",{children:"有新版更新"})]}),i&&r!=="idle"&&l.jsx("div",{className:"confirm-scrim",role:"presentation",children:l.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[l.jsx("div",{className:"studio-update-dialog-mark",children:l.jsx($C,{})}),l.jsx("div",{id:"studio-update-title",className:"confirm-title",children:r==="error"?"Studio 更新失败":r==="submitting"?"正在更新 Studio":r==="published"?"Studio 更新完成":"发现新版本"}),r==="error"?l.jsxs("div",{className:"studio-update-error-panel",children:[l.jsx("p",{className:"confirm-text studio-update-error",children:o}),l.jsxs("dl",{className:"studio-update-error-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"失败阶段"}),l.jsx("dd",{children:dye[t.errorStage]||t.errorStage||"未知阶段"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"错误 ID"}),l.jsx("dd",{children:t.errorId||"未生成"})]})]}),l.jsx(HC,{lines:R,phase:"error",copyState:p,onCopy:()=>void O()}),t.consoleUrl&&l.jsxs("a",{className:"studio-update-console-link",href:t.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",l.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):r==="submitting"||r==="published"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"studio-update-progress-summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"目标版本"}),l.jsx("strong",{children:w.current||A})]}),l.jsxs("div",{children:[l.jsx("span",{children:r==="published"?"更新状态":"已用时"}),l.jsx("strong",{children:r==="published"?"已完成":fye(g)})]})]}),l.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:UC.map((D,T)=>{const M=UC.findIndex(I=>I.id===t.progressStage),j=r==="published"||Tvoid O()}),l.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),l.jsxs("div",{className:"studio-update-field",ref:y,children:[l.jsx("span",{children:"选择版本"}),l.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":f,onClick:()=>h(D=>!D),onKeyDown:D=>{(D.key==="ArrowDown"||D.key==="ArrowUp")&&(D.preventDefault(),h(!0))},children:[l.jsx("span",{children:A}),l.jsx(mye,{})]}),f&&l.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:N.map(D=>{const T=D.version===A;return l.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`studio-update-version-option${T?" is-selected":""}`,onClick:()=>{d(D.version),h(!1)},children:[l.jsx("span",{children:D.version}),T&&l.jsx(gye,{})]},D.version)})})]}),l.jsxs("dl",{className:"studio-update-versions",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:t.currentVersion})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"目标版本"}),l.jsx("dd",{children:A})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Commit"}),l.jsx("dd",{children:((S==null?void 0:S.gitSha)||t.latestGitSha).slice(0,8)})]})]}),l.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[l.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),S!=null&&S.changelog.length?l.jsx("ul",{children:S.changelog.map(D=>l.jsx("li",{children:D},D))}):l.jsx("p",{children:"暂无更新说明"})]})]}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{a(!1),h(!1),r==="confirm"&&(s("idle"),c(""))},children:r==="submitting"?"后台运行":r==="confirm"?"取消":"关闭"}),r==="confirm"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void C(),children:"立即更新"}),r==="error"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:F,children:"重新尝试"})]})]})})]})}const bye="/web/skill-creator";class P_ extends Error{constructor(n,r){super(n);lk(this,"status");this.name="SkillCreatorApiError",this.status=r}}function xl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function gn(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function U5(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function Eh(e,t){return fetch(ji(`${bye}${e}`),{...t,headers:Zg({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function B_(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=xl(await e.json(),"错误响应");return gn(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function F_(e,t){if(!e.ok)throw new P_(await B_(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function Eye(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 xye(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function wye(e){return Array.isArray(e)?e.map((t,n)=>{const r=xl(t,`文件 ${n+1}`),s=gn(r,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const i=U5(r,"size");if(i===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:i}}):[]}function vye(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function _ye(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=xl(t,`活动 ${n+1}`),s=gn(r,"id"),i=gn(r,"kind"),a=gn(r,"status");if(!s||!i||!["status","thinking","tool","message"].includes(i))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(i==="tool"){const c=gn(r,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:i,name:c,args:r.input,response:r.output,status:a}}const o=gn(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:i,text:o,status:a}})}function kye(e,t){const n=xl(e,`候选方案 ${t+1}`),r=gn(n,"id","candidate_id","candidateId"),s=gn(n,"model","model_id","modelId");if(!r||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:s,modelLabel:gn(n,"modelLabel","model_label")??s,status:Eye(n.status),stage:xye(n.stage),name:gn(n,"name","skill_name","skillName"),description:gn(n,"description"),skillMd:gn(n,"skillMd","skill_md"),files:wye(n.files),activities:_ye(n.activities),validation:vye(n.validation),durationMs:U5(n,"elapsedMs","elapsed_ms"),error:gn(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:gn(n,"skill_id","skillId"),version:gn(n,"version")}}function xx(e,t=""){const n=xl(e,"Skill 创建任务"),r=gn(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(kye):[],i=gn(n,"status")??"running";if(i!=="provisioning"&&i!=="running"&&i!=="completed")throw new Error(`未知的 Skill 任务状态:${i}`);return{id:r,prompt:gn(n,"prompt")??t,status:i,candidates:s}}async function Nye(e,t){const n=await Eh("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new P_(await B_(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=xx(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),i=new TextDecoder;let a="",o;const c=u=>{if(!u.trim())return;const d=xl(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(gn(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=xx(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await s.read();a+=i.decode(d,{stream:!u});const f=a.split(` +`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function Sye(e){const t=await Eh(`/jobs/${encodeURIComponent(e)}`);return xx(await F_(t,"读取 Skill 任务失败"))}async function Tye(e){const t=await Eh(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await F_(t,"清理 Skill 任务失败")}async function Aye(e,t){var o;const n=await Eh(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await B_(n,"下载 Skill 失败"));const s=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",i=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}async function Cye(e,t,n){const r=await Eh(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=xl(await F_(r,"添加到 AgentKit 失败"),"发布结果"),i=gn(s,"skill_id","skillId","id");if(!i)throw new Error("发布结果缺少 skill_id");return{skillId:i,name:gn(s,"name"),version:gn(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:gn(s,"message")}}const Iye=()=>{};function Rye(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 Oye({activities:e}){const t=E.useMemo(()=>e.filter(n=>n.kind!=="status").map(Rye),[e]);return t.length===0?null:l.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:l.jsx(E_,{blocks:t,onAction:Iye})})}const zC={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},VC=12e4;function Lye({status:e}){return e==="succeeded"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):l.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function Mye(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),l.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function jye(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function Dye({candidate:e}){var c,u;const[t,n]=E.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,i=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,VC),o=(((u=e.skillMd)==null?void 0:u.length)??0)>VC;return s.length===0?null:l.jsxs("div",{className:"skill-files",children:[l.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:s.map(d=>l.jsx("button",{type:"button",role:"tab","aria-selected":(i==null?void 0:i.path)===d.path,className:(i==null?void 0:i.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(i!=null&&i.path.endsWith("SKILL.md"))?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"skill-files__content",children:l.jsx("code",{children:a})}),o?l.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):l.jsx("div",{className:"skill-files__unavailable",children:i?`${i.path} · ${i.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function Pye({label:e,jobId:t,candidate:n,selected:r,publishing:s,publishDisabled:i,publishError:a,onSelect:o,onPublish:c}){const[u,d]=E.useState("conversation"),[f,h]=E.useState(!1),[p,m]=E.useState(!1),[g,x]=E.useState(""),[y,w]=E.useState(""),[b,_]=E.useState(""),[k,N]=E.useState(""),A=E.useRef(null),S=E.useRef(null),C=n.status==="queued"||n.status==="running",R=n.status==="succeeded",O=n.validation;return l.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[l.jsxs("header",{className:"skill-candidate__header",children:[l.jsx("h2",{children:n.model}),r?l.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[l.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[l.jsx("span",{className:"skill-candidate__status-icon",children:l.jsx(Lye,{status:n.status})}),C?l.jsx(pa,{duration:2.2,spread:16,children:zC[n.stage]}):l.jsx("span",{children:zC[n.stage]}),n.durationMs!==void 0&&R?l.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),l.jsx(Oye,{activities:n.activities}),n.error?l.jsx("div",{className:"skill-candidate__error",children:n.error}):null,R?l.jsx("div",{className:"skill-candidate__view-actions",children:l.jsxs("button",{ref:A,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var F;return(F=S.current)==null?void 0:F.focus()})},children:[l.jsx(Mye,{}),"查看 Skill"]})}):null]}):l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[l.jsx("div",{className:"skill-candidate__preview-nav",children:l.jsxs("button",{ref:S,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var F;return(F=A.current)==null?void 0:F.focus()})},children:[l.jsx(jye,{}),"返回对话"]})}),l.jsxs("div",{className:"skill-candidate__result",children:[l.jsxs("div",{className:"skill-candidate__summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"Skill"}),l.jsx("strong",{children:n.name??"未命名 Skill"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"文件"}),l.jsx("strong",{children:n.files.length})]}),l.jsxs("div",{children:[l.jsx("span",{children:"校验"}),l.jsx("strong",{className:(O==null?void 0:O.valid)===!1?"is-invalid":"is-valid",children:(O==null?void 0:O.valid)===!1?"未通过":"已通过"})]})]}),n.description?l.jsx("p",{className:"skill-candidate__description",children:n.description}):null,O&&(O.errors.length>0||O.warnings.length>0)?l.jsxs("details",{className:"skill-validation",children:[l.jsx("summary",{children:"查看校验详情"}),[...O.errors,...O.warnings].map((F,q)=>l.jsx("div",{children:F},`${F}-${q}`))]}):null,l.jsx(Dye,{candidate:n}),l.jsxs("div",{className:"skill-candidate__actions",children:[l.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),l.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),x(""),Aye(t,n.id).catch(F=>{x(F instanceof Error?F.message:String(F))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),l.jsx("button",{type:"button",className:"skill-action",disabled:!r||s||i||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(F=>!F),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),g?l.jsx("div",{className:"skill-candidate__error",children:g}):null,f&&r&&!n.published?l.jsxs("form",{className:"skill-publish-form",onSubmit:F=>{F.preventDefault();const q=y.split(",").map(L=>L.trim()).filter(Boolean);c({skillSpaceIds:q,...b.trim()?{projectName:b.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[l.jsxs("label",{children:[l.jsx("span",{children:"SkillSpace ID(可选)"}),l.jsx("input",{value:y,onChange:F=>w(F.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),l.jsxs("div",{className:"skill-publish-form__optional",children:[l.jsxs("label",{children:[l.jsx("span",{children:"项目名称(可选)"}),l.jsx("input",{value:b,onChange:F=>_(F.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"已有 Skill ID(可选)"}),l.jsx("input",{value:k,onChange:F=>N(F.target.value)})]})]}),l.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?l.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const KC=new Set(["completed"]),Cp=1100,Bye=3e4;function Fye(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 Uye({initialJob:e}){const[t,n]=E.useState(e),[r,s]=E.useState(""),[i,a]=E.useState(!1),[o,c]=E.useState(),[u,d]=E.useState(),[f,h]=E.useState(()=>new Set),[p,m]=E.useState({});E.useEffect(()=>{n(e),s(""),a(!1)},[e]),E.useEffect(()=>{if(KC.has(e.status)||e.id.startsWith("pending-"))return;let y=!1,w;const b=Date.now()+Bye,_=async()=>{try{const k=await Sye(e.id);y||(n({...k,prompt:k.prompt||e.prompt}),s(""),KC.has(k.status)||(w=window.setTimeout(_,Cp)))}catch(k){if(!y){const N=k instanceof P_?k:void 0;if((N==null?void 0:N.status)===404&&Date.now(){y=!0,w!==void 0&&window.clearTimeout(w)}},[e.id,e.status]);const g=x_.map((y,w)=>t.candidates.find(b=>b.model===y)??t.candidates[w]??Fye(y,w));async function x(y,w){d(y.id),m(b=>({...b,[y.id]:""}));try{await Cye(t.id,y.id,w),h(b=>new Set(b).add(y.id))}catch(b){m(_=>({..._,[y.id]:b instanceof Error?b.message:String(b)}))}finally{d(void 0)}}return l.jsxs("section",{className:"skill-workspace",children:[l.jsx("header",{className:"skill-workspace__intro",children:l.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?l.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",i?"":"页面会继续重试。"]}):null,l.jsx("div",{className:"skill-workspace__grid",children:g.map((y,w)=>{const _=f.has(y.id)||y.published?{...y,published:!0}:y;return l.jsx(Pye,{label:`方案 ${w===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===y.id,publishing:u===y.id,publishDisabled:u!==void 0&&u!==y.id,publishError:p[y.id],onSelect:()=>c(y.id),onPublish:k=>void x(y,k)},`${y.model}-${y.id}`)})})]})}const Vb="/web/sandbox/sessions",$ye=33e4,Hye=6e5,zye=15e3;function Kb(e){const t=Zg(e);return t.set("Accept","application/json"),t}async function Yb(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,s=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof s=="string"&&s?s:t)}async function Vye(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let s="",i="";const a=[],o=new Map;function c(){t==null||t(a.map(h=>({...h})))}function u(h){i+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),c()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const g=o.get(h.id);g===void 0?(o.set(h.id,a.length),a.push(m)):a[g]=m,c()}function f(h){let p="message";const m=[];for(const x of h.split(/\r?\n/))x.startsWith("event:")&&(p=x.slice(6).trim()),x.startsWith("data:")&&m.push(x.slice(5).trimStart());if(m.length===0)return;let g;try{g=JSON.parse(m.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof g.message=="string"&&g.message?g.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(g),p==="delta"&&typeof g.text=="string"&&u(g.text),p==="done"&&!i&&typeof g.text=="string"&&u(g.text)}for(;;){const{done:h,value:p}=await n.read();s+=r.decode(p,{stream:!h});const m=s.split(/\r?\n\r?\n/);if(s=m.pop()??"",m.forEach(f),h)break}if(s.trim()&&f(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:i,blocks:a}}const Gb={async startSession(e={}){const t=await fetch(ji(Vb),{method:"POST",headers:Kb({"Content-Type":"application/json"}),signal:ci(e.signal,$ye)});if(!t.ok)throw await Yb(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(ji(`${Vb}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:Kb({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:ci(t.signal,Hye)});if(!n.ok)throw await Yb(n,"沙箱对话失败,请稍后重试。");return Vye(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(ji(`${Vb}/${encodeURIComponent(e)}`),{method:"DELETE",headers:Kb(),signal:ci(t.signal,zye)});if(!n.ok&&n.status!==404)throw await Yb(n,"无法清理 AgentKit 沙箱会话。")}},Kye=1e4;async function $5(e){const t=await fetch(ji(e),{headers:Zg({Accept:"application/json"}),signal:ci(void 0,Kye)});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 Yye(){return $5("/web/sandbox/capabilities")}async function Gye(){return $5("/web/skill-creator/capabilities")}function Wye(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),l.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),l.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function qye({open:e,state:t,error:n,onCancel:r,onConfirm:s}){const i=E.useRef(null),a=E.useRef(null);if(E.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var x;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(x=i.current)==null?void 0:x.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],g=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",c=o?"正在初始化沙箱":t==="error"?"启动失败":"启用 Codex 智能体";return Us.createPortal(l.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:l.jsxs("section",{ref:i,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[l.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[l.jsx("span",{className:"sandbox-dialog-orbit"}),l.jsx("span",{className:"sandbox-dialog-icon",children:o?l.jsx("span",{className:"sandbox-spinner"}):l.jsx(Wye,{})})]}),l.jsxs("div",{className:"sandbox-dialog-copy",children:[l.jsx("h2",{id:"sandbox-dialog-title",children:c}),t==="error"?l.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?l.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建内置智能体会话,通常需要一点时间。"}):l.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex 智能体,本次对话不会被持久化保存。"})]}),l.jsxs("footer",{className:"sandbox-dialog-actions",children:[l.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&l.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function Xye({onExit:e}){return l.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[l.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),l.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为 Codex 智能体会话,退出后对话内容消失"}),l.jsx("button",{type:"button",onClick:e,children:"退出内置智能体"})]})}function Qye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function Zye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}const YC=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Wb(e){let t=0;for(let n=0;n>>0;return YC[t%YC.length]}function Jye(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];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):r.push(u);const s=(u,d)=>u.start_time-d.start_time,i=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>i(f,d+1))}),a=r.sort(s).map(u=>i(u,0)),o=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:o,total:c-o||1}}function ebe(e,t){const n=[],r=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(r)};return e.forEach(r),n}function GC(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const tbe=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function WC(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:tbe(t),value:r,long:r.length>80||r.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function nbe({appName:e,sessionId:t,onClose:n}){const[r,s]=E.useState(null),[i,a]=E.useState(""),[o,c]=E.useState(new Set),[u,d]=E.useState(null);E.useEffect(()=>{s(null),a(""),vM(e,t).then(w=>{s(w),d(w.length?w.reduce((b,_)=>b.start_time<=_.start_time?b:_).span_id:null)}).catch(w=>a(String(w)))},[e,t]);const{rootNodes:f,min:h,total:p}=E.useMemo(()=>Jye(r??[]),[r]),m=E.useMemo(()=>ebe(f,o),[f,o]),g=(r==null?void 0:r.find(w=>w.span_id===u))??null,x=p/1e6,y=w=>c(b=>{const _=new Set(b);return _.has(w)?_.delete(w):_.add(w),_});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim",onClick:n}),l.jsxs("aside",{className:"drawer drawer--trace",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{className:"drawer-title",children:"调用链路观测"}),l.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${x.toFixed(1)} ms`:"加载中"})]}),l.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:l.jsx(Zr,{className:"icon"})})]}),r==null&&!i&&l.jsxs("div",{className:"drawer-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载调用链路…"]}),i&&l.jsx("div",{className:"error",children:i}),r&&r.length===0&&l.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&l.jsxs("div",{className:"trace-split",children:[l.jsx("div",{className:"trace-tree scroll",children:m.map(w=>{const b=w.span,_=(b.start_time-h)/p*100,k=Math.max((b.end_time-b.start_time)/p*100,.6),N=w.children.length>0;return l.jsxs("button",{className:`trace-row ${u===b.span_id?"active":""}`,onClick:()=>d(b.span_id),children:[l.jsxs("span",{className:"trace-label",style:{paddingLeft:w.depth*14},children:[l.jsx("span",{className:`trace-caret ${N?"":"hidden"} ${o.has(b.span_id)?"":"open"}`,onClick:A=>{A.stopPropagation(),N&&y(b.span_id)},children:l.jsx(Ms,{className:"chev"})}),l.jsx("span",{className:"trace-dot",style:{background:Wb(b.name)}}),l.jsx("span",{className:"trace-name",title:b.name,children:b.name})]}),l.jsx("span",{className:"trace-dur",children:GC(b.end_time-b.start_time)}),l.jsx("span",{className:"trace-track",children:l.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:Wb(b.name)}})})]},b.span_id)})}),l.jsx("div",{className:"trace-detail scroll",children:g?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"td-title",children:g.name}),l.jsxs("div",{className:"td-dur",children:[l.jsx("span",{className:"td-dot",style:{background:Wb(g.name)}}),GC(g.end_time-g.start_time)]}),l.jsx("div",{className:"td-section",children:"属性"}),l.jsx("div",{className:"td-props",children:WC(g).filter(w=>!w.long).map(w=>l.jsxs("div",{className:"td-prop",children:[l.jsx("span",{className:"td-key",children:w.key}),l.jsx("span",{className:"td-val",children:w.value})]},w.key))}),WC(g).filter(w=>w.long).map(w=>l.jsxs("div",{className:"td-block",children:[l.jsx("div",{className:"td-section",children:w.key}),l.jsx("pre",{className:"td-pre",children:w.value})]},w.key))]}):l.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function rbe(e){return e.toLowerCase()==="github"?l.jsx(Ez,{className:"icon"}):l.jsx(Nz,{className:"icon"})}function sbe({branding:e,onUsername:t}){const[n,r]=E.useState(null),[s,i]=E.useState(""),[a,o]=E.useState(0),[c,u]=E.useState(""),d=E.useRef(null);E.useEffect(()=>{let m=!0;return r(null),i(""),dM().then(g=>{m&&r(g)}).catch(g=>{m&&i(g instanceof Error?g.message:String(g))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;E.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=Yz.test(c),p=()=>{h&&t(c)};return l.jsxs("div",{className:"login",children:[l.jsx("header",{className:"login-top",children:l.jsxs("span",{className:"login-brand",children:[l.jsx("img",{className:"login-brand-logo",src:e.logoUrl||mv,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),l.jsx("main",{className:"login-main",children:l.jsxs("div",{className:"login-card",children:[l.jsx(pa,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?l.jsxs("div",{className:"login-provider-error",role:"alert",children:[l.jsx("p",{children:s}),l.jsx("button",{type:"button",onClick:()=>o(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"登录以继续使用"}),l.jsx("div",{className:"login-providers",children:n.map(m=>l.jsxs("button",{className:"login-btn",onClick:()=>Wz(m.loginUrl),children:[rbe(m.id),l.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),l.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[l.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),l.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:l.jsx(Id,{className:"icon"})})]}),l.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),l.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),l.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",l.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),l.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function ibe({open:e,checking:t,error:n,onLogin:r}){const s=E.useRef(null);return E.useEffect(()=>{var a;if(!e)return;const i=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=i}},[e]),e?Us.createPortal(l.jsx("div",{className:"auth-expired-backdrop",children:l.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[l.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:l.jsx(qg,{})}),l.jsxs("div",{className:"auth-expired-copy",children:[l.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),l.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&l.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),l.jsx("footer",{className:"auth-expired-actions",children:l.jsx("button",{ref:s,type:"button",onClick:r,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function abe({node:e,ctx:t}){const n=e.variant??"default";return l.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}El("Button",abe);function obe({node:e,ctx:t}){return l.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}El("Card",obe);const lbe={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},cbe={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function H5(e){return lbe[e]??"flex-start"}function z5(e){return cbe[e]??"stretch"}function ube({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:H5(e.justify),alignItems:z5(e.align)},children:n.map(r=>t.render(r))})}El("Column",ube);function dbe({node:e}){const t=e.axis==="vertical";return l.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}El("Divider",dbe);const fbe={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function hbe({node:e}){const t=e.name??"";return l.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:fbe[t]??"•"})}El("Icon",hbe);function pbe({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:H5(e.justify),alignItems:z5(e.align??"center")},children:n.map(r=>t.render(r))})}El("Row",pbe);const mbe=new Set(["h1","h2","h3","h4","h5"]);function gbe({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),s=mbe.has(n)?n:"p";return l.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}El("Text",gbe);const ybe="创建 Agent",bbe={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流",package:"代码包部署"},Io={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},Ebe=new Set,xbe=[];function Xi(){return{skills:[]}}function Lo(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function qb(e){return`${Lo(e)}.active`}function wx(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function wbe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(Lo(e))||"[]");return Array.isArray(t)?t:[]}catch{return[]}}function vbe(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(wx(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function vx(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const r=vx(n,t);if(r)return r}}function V5(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...V5(n)));return t}function qC(){const e=typeof localStorage<"u"?localStorage.getItem(Io.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function _be({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),l.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function kbe(){return l.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),l.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function K5(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function Nbe(e){if(!e)return"";const t=[];return e.ts&&t.push(K5(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function XC(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const Sbe="send_a2ui_json_to_client";function Tbe(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===Sbe&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?h6(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function Abe(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Cbe(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let i=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},o=d=>{if(!i){i=!0,a();try{s.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!i){if(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(i=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function Ibe(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=r.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,r.oauth2=s,n.exchangedAuthCredential=r,n}function QC({text:e}){const[t,n]=E.useState(!1);return l.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?l.jsx(pi,{className:"icon"}):l.jsx(Zw,{className:"icon"})})}function Rbe(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function Obe({tasks:e,onCancel:t}){const[n,r]=E.useState(!1),[s,i]=E.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],c=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{i(f.id),t(f).finally(()=>i(null))};return l.jsxs("div",{className:"global-deploy-center",children:[l.jsxs("button",{type:"button",className:`global-deploy-task is-${c}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[c==="running"?l.jsx(Kt,{className:"global-deploy-task-icon spin"}):c==="success"?l.jsx(QL,{className:"global-deploy-task-icon"}):c==="error"?l.jsx(qg,{className:"global-deploy-task-icon"}):c==="cancelled"?l.jsx(cE,{className:"global-deploy-task-icon"}):l.jsx(kz,{className:"global-deploy-task-icon"}),l.jsx("span",{className:"global-deploy-task-detail",children:u}),l.jsx(Xw,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),l.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[l.jsxs("header",{className:"global-deploy-popover-head",children:[l.jsx("span",{children:"部署任务"}),l.jsx("span",{children:e.length})]}),l.jsx("div",{className:"global-deploy-list",children:e.length===0?l.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return l.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[l.jsxs("div",{className:"global-deploy-item-head",children:[l.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),l.jsx("span",{className:"global-deploy-status",children:h})]}),l.jsxs("dl",{className:"global-deploy-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime 名称"}),l.jsx("dd",{children:f.runtimeName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署地域"}),l.jsx("dd",{children:Rbe(f.region)})]}),f.runtimeId&&l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime ID"}),l.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?l.jsx(wg,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?l.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:l.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),l.jsx("div",{className:"global-deploy-item-actions",children:l.jsx("button",{type:"button",disabled:s===f.id,onClick:()=>d(f),children:s===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const ZC=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],JC=()=>ZC[Math.floor(Math.random()*ZC.length)];function Xb(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function Lbe(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Mbe(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function jbe(){const[e,t]=E.useState([]),[n,r]=E.useState(""),[s,i]=E.useState([]),[a,o]=E.useState(""),c=E.useRef(null),[u,d]=E.useState(!1),[f,h]=E.useState([]),[p,m]=E.useState(null),[g,x]=E.useState([]),[y,w]=E.useState(!1),[b,_]=E.useState(!1),[k,N]=E.useState("confirm"),[A,S]=E.useState(""),C=E.useRef(null),R=E.useRef(null),[O,F]=E.useState({}),q=a?O[a]??[]:f,L=p?g:q,D=(P,Y)=>F(ae=>({...ae,[P]:typeof Y=="function"?Y(ae[P]??[]):Y})),[T,M]=E.useState(""),[j,U]=E.useState("agent"),[I,K]=E.useState({}),[W,B]=E.useState(null),[ie,Q]=E.useState(!1),ee=E.useRef(0),[ce,J]=E.useState([]),[fe,te]=E.useState(Xi),[ge,we]=E.useState(null),[Z,me]=E.useState(!1),[Ne,Ie]=E.useState(null),[We,Ce]=E.useState(!1),[et,Ge]=E.useState([]),[Xe,xt]=E.useState(!1),gt=E.useRef(new Set),[At,ut]=E.useState(()=>new Set),[X,ne]=E.useState(()=>new Set),he=E.useRef(new Map),Te=E.useRef(new Map),He=(P,Y)=>ut(ae=>{const de=new Set(ae);return Y?de.add(P):de.delete(P),de}),qe=P=>{const Y=Te.current.get(P);Y!==void 0&&window.clearTimeout(Y),Te.current.delete(P),ne(ae=>new Set(ae).add(P))},Ut=P=>{const Y=Te.current.get(P);Y!==void 0&&window.clearTimeout(Y);const ae=window.setTimeout(()=>{Te.current.delete(P),ne(de=>{const Se=new Set(de);return Se.delete(P),Se})},2400);Te.current.set(P,ae)},Ye=E.useRef(""),[De,Be]=E.useState(""),[Ct,un]=E.useState(""),$t=E.useRef(null);E.useEffect(()=>()=>{$t.current!==null&&window.clearTimeout($t.current)},[]);const[wn,Fe]=E.useState(()=>new Set),[dt,Lt]=E.useState(!1),[_t,be]=E.useState(!1),Ve=E.useRef(null),st=E.useCallback(()=>be(!1),[]),[sn,an]=E.useState(JC),[Ht,zt]=E.useState(null),[Bt,qt]=E.useState(!1),[vn,Xt]=E.useState(!1),[Ln,Mn]=E.useState(""),ue=E.useRef(!1),[_e,ve]=E.useState(null),[ye,nt]=E.useState(""),[Qe,ct]=E.useState(),[ot,oe]=E.useState(null),[Ze,It]=E.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[it,kt]=E.useState("cloud"),[Ft,Zn]=E.useState(Ef),[or,lr]=E.useState(""),[dn,Zt]=E.useState("chat"),[Yt,Jt]=E.useState(!1),[Mt,Cn]=E.useState(!1),[fn,en]=E.useState(!1),[Vn,hn]=E.useState({}),[gr,Kn]=E.useState({}),[bs,yr]=E.useState({}),es=At.has(a),Es=X.has(a),bi=es||u,po=!!a&&We,xs=p?y:bi,Ei=xs||!p&&Es,$i=Vn[a]??"",Ur=gr[a]??Ebe,Ar=bs[a]??xbe,Jn=ge==null?void 0:ge.graph,Ea=[ge==null?void 0:ge.name,Jn==null?void 0:Jn.name,Jn==null?void 0:Jn.id].filter(P=>!!P),Hi=fe.targetAgent&&Jn?vx(Jn,fe.targetAgent.name):Jn,wl=(Hi==null?void 0:Hi.skills)??(fe.targetAgent?[]:(ge==null?void 0:ge.skills)??[]),vl=Jn?V5(Jn):[];function xa(P){Xb(P);for(const Y of P)Y.status==="uploading"?gt.current.add(Y.id):Y.uri&&Gp(n,Y.uri).catch(ae=>Be(String(ae)))}function wa(){ee.current+=1;const P=W;B(null),Q(!1),P&&!P.id.startsWith("pending-")&&Tye(P.id).catch(Y=>{Be(Y instanceof Error?Y.message:String(Y))})}async function va(P){try{await hE(n,ye,P),await fE(n,ye,P),i(Y=>Y.filter(ae=>ae.id!==P)),F(Y=>{const{[P]:ae,...de}=Y;return de})}catch(Y){Be(String(Y))}}function mo(P){const Y=ce.find(Se=>Se.id===P);if(!Y)return;const ae=ce.filter(Se=>Se.id!==P);Xb([Y]),Y.status==="uploading"&>.current.add(P),J(ae),ae.length===0&&!T.trim()&&!!a&&L.length===0?(Ye.current="",o(""),va(a)):Y.uri&&Gp(n,Y.uri).catch(Se=>Be(String(Se)))}const _a=(P,Y)=>{var xe,Me,Ke,Pe,jt;const ae=Y.author&&Y.author!=="user"?Y.author:void 0;ae&&(hn(tt=>({...tt,[P]:ae})),Kn(tt=>({...tt,[P]:new Set(tt[P]??[]).add(ae)})),yr(tt=>{var ft;return(ft=tt[P])!=null&&ft.length?tt:{...tt,[P]:[ae]}}));const de=((xe=Y.actions)==null?void 0:xe.transferToAgent)??((Me=Y.actions)==null?void 0:Me.transfer_to_agent);de&&yr(tt=>{const ft=tt[P]??[];return ft[ft.length-1]===de?tt:{...tt,[P]:[...ft,de]}}),(((Ke=Y.actions)==null?void 0:Ke.endOfAgent)??((Pe=Y.actions)==null?void 0:Pe.end_of_agent)??((jt=Y.actions)==null?void 0:jt.escalate))&&yr(tt=>{const ft=tt[P]??[];return ft.length<=1?tt:{...tt,[P]:ft.slice(0,-1)}})},[Vs,vt]=E.useState(qC),[z,re]=E.useState([]),Ee=E.useCallback(P=>{re(Y=>{const ae=Y.findIndex(Se=>Se.id===P.id);if(ae===-1)return[P,...Y];const de=[...Y];return de[ae]={...de[ae],...P},de})},[]),$=E.useCallback(async P=>{try{await RM(P.id),re(Y=>Y.map(ae=>ae.id===P.id?{...ae,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:ae))}catch(Y){const ae=Y instanceof Error?Y.message:String(Y);re(de=>de.map(Se=>Se.id===P.id?{...Se,message:`取消失败:${ae}`}:Se))}},[]),[le,Re]=E.useState(!0),[$e,pt]=E.useState(!1),[at,lt]=E.useState(!1),[Yn,yt]=E.useState(!1),[er,Rt]=E.useState(null),[cr,ur]=E.useState([]),[_l,xh]=E.useState([]),[$r,Ks]=E.useState(""),ws=E.useRef(null),[wh,Hr]=E.useState(!1),[H0,pn]=E.useState(!1),[U_,z0]=E.useState(""),[Y5,G5]=E.useState("good"),[W5,_u]=E.useState("basic"),[q5,X5]=E.useState("good"),[vh,_h]=E.useState(""),[ku,Cr]=E.useState(!1),V0=E.useRef(null),[Nu,go]=E.useState(()=>{const P=os();return uu(P),P}),[Q5,$_]=E.useState(!1),[Z5,K0]=E.useState(""),[H_,kh]=E.useState(null),[J5,z_]=E.useState({}),[kl,xi]=E.useState(null),[V_,vs]=E.useState(""),[Y0,ts]=E.useState(""),[_s,Ys]=E.useState(null),[eB,Nh]=E.useState(!1),G0=E.useRef(!1),Sh=E.useRef(!1),tB=E.useCallback((P,Y,ae)=>{!P||!ye||ur(de=>{const xe=[{id:P,draft:Y,updatedAt:Date.now(),deploymentTarget:ae},...de.filter(Me=>Me.id!==P)];return localStorage.setItem(Lo(ye),JSON.stringify(xe)),xe})},[ye]),W0=E.useCallback(P=>{!P||!ye||ur(Y=>{const ae=Y.filter(de=>de.id!==P);return localStorage.setItem(Lo(ye),JSON.stringify(ae)),ae})},[ye]),nB=E.useCallback(P=>{if(!ye||P.length===0)return;const Y=new Set(P.map(ae=>ae.id));ur(ae=>{const de=ae.filter(Se=>!Y.has(Se.id));return localStorage.setItem(Lo(ye),JSON.stringify(de)),de}),Y.has($r)&&(Ks(""),Rt(null),xi(null),ws.current=null,localStorage.removeItem(qb(ye)))},[$r,ye]),K_=E.useCallback(P=>{if(!P||!ye)return;const Y=ws.current;ur(ae=>{const de=ae.filter(xe=>xe.id!==P),Se=(Y==null?void 0:Y.id)===P?[Y,...de]:de;return localStorage.setItem(Lo(ye),JSON.stringify(Se)),Se})},[ye]);E.useEffect(()=>{if(!ye){ur([]),xh([]),Ks(""),ws.current=null;return}const P=wbe(ye);ur(P),xh(vbe(ye));const Y=localStorage.getItem(qb(ye))||"",ae=P.find(de=>de.id===Y);ws.current=ae??null,Vs==="custom"&&ae&&(Ks(ae.id),Rt(ae.draft),xi(ae.deploymentTarget??null))},[ye]),E.useEffect(()=>{if(!ye)return;const P=qb(ye);Vs==="custom"&&$r?localStorage.setItem(P,$r):localStorage.removeItem(P)},[Vs,$r,ye]);const rB=E.useCallback(P=>{if(!ye)return;const Y=[...new Set(P.filter(Boolean))];xh(Y),localStorage.setItem(wx(ye),JSON.stringify(Y))},[ye]),sB=E.useCallback(async P=>{const Y=P.filter(xe=>!!xe.runtimeId&&xe.canDelete===!0);if(Y.length===0)return;const ae=new Set,de=new Set,Se=[];for(const xe of Y)try{await BM(xe.runtimeId,xe.region??"cn-beijing"),Gm(xe.runtimeId),ae.add(xe.runtimeId),de.add(xe.id)}catch(Me){const Ke=Me instanceof Error?Me.message:String(Me);Se.push(`${xe.label}: ${Ke}`)}if(ae.size>0&&(go(os()),kh(xe=>{if(!xe)return xe;const Me=new Set(xe);for(const Ke of ae)Me.delete(Ke);return Me}),z_(xe=>Object.fromEntries(Object.entries(xe).filter(([Me])=>!ae.has(Me)))),xh(xe=>{const Me=xe.filter(Ke=>!de.has(Ke));return ye&&localStorage.setItem(wx(ye),JSON.stringify(Me)),Me}),ur(xe=>{const Me=xe.filter(Ke=>{var Pe;return!((Pe=Ke.deploymentTarget)!=null&&Pe.runtimeId)||!ae.has(Ke.deploymentTarget.runtimeId)});return ye&&localStorage.setItem(Lo(ye),JSON.stringify(Me)),Me}),Y.some(xe=>xe.id===n)&&(Ye.current="",o(""),r(""))),Se.length>0){const xe=Se.slice(0,3).join(";"),Me=Se.length>3?`;另有 ${Se.length-3} 个失败`:"";throw new Error(`${Se.length} 个 Agent 删除失败:${xe}${Me}`)}},[n,ye]),q0=E.useCallback(async()=>{$_(!0),K0("");try{const P=[];let Y="";do{const de=await bc({scope:"mine",region:"all",pageSize:100,nextToken:Y});P.push(...de.runtimes),Y=de.nextToken}while(Y&&P.length<2e3);kh(new Set(P.map(de=>de.runtimeId))),z_(Object.fromEntries(P.map(de=>[de.runtimeId,{canDelete:de.canDelete}])));const ae=[];for(const de of P)try{await Ld(de.runtimeId,de.name,de.region,de.currentVersion)}catch{ae.push(de.name)}go(os()),ae.length>0&&K0(`${ae.length} 个 Runtime 暂时无法读取,请稍后重试。`)}catch(P){K0(P instanceof Error?P.message:String(P))}finally{$_(!1)}},[]);function Th(P){console.log("create agent draft:",P),vt(null),xo()}function X0(P,Y){console.log("Agent added, navigating to:",P,Y),go(os()),kh(null),W0($r),Ks(""),ws.current=null,xi(null),vs(""),ts(P),_u("basic"),vt(null),pn(!0),r(P)}const iB=E.useCallback(P=>{vt(null),yt(!1),Ys(null),pn(!0),ts(""),_u("basic"),vs(P.id),Be("")},[]),aB=E.useCallback(async P=>{if(!P.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const Y=(kl==null?void 0:kl.region)??"cn-beijing",ae=await Ld(P.runtimeId,P.agentName,P.region??Y,P.version);go(os()),kh(de=>{const Se=new Set(de??[]);return Se.add(P.runtimeId),Se}),xi(null),W0($r),Ks(""),ws.current=null,ts(ae),_u("basic"),vt(null),pn(!0),r(ae)},[$r,W0,kl]),Su=E.useRef(null),Q0=E.useRef(new Map),yo=E.useRef(!0),ka=E.useRef(!1),bo=E.useRef(null),Y_=E.useRef({key:"",turnCount:0}),Z0=(p==null?void 0:p.id)??a;E.useLayoutEffect(()=>{const P=Su.current,Y=Y_.current,ae=Y.key!==Z0,de=!ae&&L.length>Y.turnCount;if(Y_.current={key:Z0,turnCount:L.length},!P||L.length===0||!ae&&!de)return;yo.current=!0,ka.current=!1,bo.current!==null&&(window.clearTimeout(bo.current),bo.current=null);const Se=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ae||Se){P.scrollTop=P.scrollHeight;return}ka.current=!0,P.scrollTo({top:P.scrollHeight,behavior:"smooth"}),bo.current=window.setTimeout(()=>{ka.current=!1,bo.current=null},450)},[Z0,L.length]),E.useLayoutEffect(()=>{const P=Su.current;!P||!yo.current||ka.current||(P.scrollTop=P.scrollHeight)},[xs,L]),E.useEffect(()=>{if(!vh||H0||L.length===0)return;const P=Q0.current.get(vh);if(!P)return;yo.current=!1,P.scrollIntoView({behavior:"smooth",block:"center"});const Y=window.setTimeout(()=>{_h("")},2600);return()=>window.clearTimeout(Y)},[vh,H0,L]),E.useEffect(()=>()=>{bo.current!==null&&window.clearTimeout(bo.current)},[]);const oB=E.useCallback(()=>{const P=Su.current;!P||ka.current||(yo.current=P.scrollHeight-P.scrollTop-P.clientHeight<32)},[]),lB=E.useCallback(P=>{P.deltaY<0&&(ka.current=!1,yo.current=!1)},[]),cB=E.useCallback(()=>{ka.current=!1,yo.current=!1},[]),uB=E.useCallback(()=>{const P=Su.current;!P||!yo.current||ka.current||(P.scrollTop=P.scrollHeight)},[]),J0=E.useCallback(()=>{ve(null),uE().then(P=>{nt(P.userId),ct(P.info),Cn(!!P.local),zt(P.status),P.status==="authenticated"&&(vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Cr(!0))}).catch(P=>{ve(P instanceof Error?P.message:String(P))})},[]);E.useEffect(()=>{J0()},[J0]),E.useEffect(()=>{const P=()=>{Mn(""),qt(!0)};return window.addEventListener(dE,P),nV()&&P(),()=>window.removeEventListener(dE,P)},[]);const dB=E.useCallback(async()=>{if(ue.current)return;ue.current=!0;const P=qz();if(!P){ue.current=!1,Mn("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}Xt(!0),Mn("");try{for(;;){await new Promise(Y=>window.setTimeout(Y,1e3));try{const Y=await uE();if(Y.status==="authenticated"){nt(Y.userId),ct(Y.info),Cn(!!Y.local),zt(Y.status),qt(!1),rV(),P.close();return}}catch{}if(P.closed){Mn("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{ue.current=!1,Xt(!1)}},[]);E.useEffect(()=>{Mt&&ye&&US(ye)},[Mt,ye]),E.useEffect(()=>{if(Ht!=="authenticated"||!ye){K({});return}let P=!1;return Promise.allSettled([Yye(),Gye()]).then(([Y,ae])=>{P||K({temporaryEnabled:Y.status==="fulfilled"&&Y.value.enabled,skillCreateEnabled:ae.status==="fulfilled"&&ae.value.enabled})}),()=>{P=!0}},[Ht,ye]),E.useEffect(()=>{if(Ht!=="authenticated"||!ye){oe(null);return}let P=!1;return oe(null),MM().then(Y=>{P||oe(Y)}).catch(Y=>{console.warn("[app] /web/access failed; using ordinary-user access:",Y),P||oe(LM)}),()=>{P=!0}},[Ht,ye]),E.useEffect(()=>{OM().then(P=>{It(P.features),kt(P.agentsSource),Zn(P.branding),lr(P.version),Zt(P.defaultView),Jt(!0)})},[]),E.useEffect(()=>{!ot||!Yt||Sh.current||ku||(Sh.current=!0,dn==="addAgent"&&ot.capabilities.createAgents&&(vt(null),pt(!1),Hr(!1),pn(!1),lt(!1),yt(!0)))},[ot,dn,ku,Yt]),E.useEffect(()=>{ot&&(ot.capabilities.createAgents||(vt(null),Rt(null),lt(!1),yt(!1),re([])),ot.capabilities.manageAgents||pn(!1))},[ot]),E.useEffect(()=>{Ht!=="authenticated"||it!=="cloud"||!Yt||q0()},[it,Ht,q0,Yt]),E.useEffect(()=>{document.title=Ft.title;let P=document.querySelector('link[rel~="icon"]');P||(P=document.createElement("link"),P.rel="icon",document.head.appendChild(P)),P.removeAttribute("type"),P.href=Ft.logoUrl||mv},[Ft]),E.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then(P=>P.ok?P.json():null).then(P=>{P&&Re(!!P.credentials)}).catch(P=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",P)})},[]);function fB(P){US(P),G0.current=!0,Sh.current=!1,oe(null),vt(null),Rt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),xo(),Cr(!0),nt(P),ct({name:P}),Cn(!0),zt("authenticated")}function hB(){Sh.current=!1,oe(null),Mt?(Gz(),nt(""),ct(void 0),zt("unauthenticated")):Qz()}E.useEffect(()=>{Ht!=="unauthenticated"&&mM().then(P=>{if(t(P),it==="cloud"){const xe=localStorage.getItem(Io.app),Me=Nu.flatMap(Ke=>Ke.apps.map(Pe=>Ja(Ke.id,Pe)));r(Ke=>Ke&&Me.includes(Ke)?Ke:xe&&Me.includes(xe)?xe:Me[0]??"");return}const Y=localStorage.getItem(Io.app),ae=Nu.flatMap(xe=>xe.apps.map(Me=>Ja(xe.id,Me))),de=Y&&(P.includes(Y)||ae.includes(Y)),Se=["web_search_agent","web_demo"].find(xe=>P.includes(xe))??P.find(xe=>!/^\d/.test(xe))??P[0];r(de?Y:Se||"")}).catch(P=>Be(String(P)))},[Ht,it,Nu]),E.useEffect(()=>{n&&localStorage.setItem(Io.app,n)},[n]),E.useEffect(()=>{let P=!1;if(Ie(null),Ge([]),!n||!ye||!a){Ce(!1);return}return Ce(!0),_M(n,ye,a).then(Y=>{P||(Ie(Y),kM(n).then(ae=>{P||Ge(ae)}).catch(()=>{P||Ge([])}))}).catch(()=>{P||Ie(null)}).finally(()=>{P||Ce(!1)}),()=>{P=!0}},[n,ye,a]),E.useEffect(()=>{let P=!1;if(we(null),te(Xi()),!n){me(!1);return}return me(!0),fv(n).then(Y=>{P||we(Y)}).catch(()=>{P||we(null)}).finally(()=>{P||me(!1)}),()=>{P=!0}},[n]),E.useEffect(()=>{ot&&localStorage.setItem(Io.view,ot.capabilities.createAgents?Vs??"chat":"chat")},[ot,Vs]),E.useEffect(()=>{localStorage.setItem(Io.session,a),Ye.current=a},[a]),E.useEffect(()=>()=>he.current.forEach(P=>P.abort()),[]),E.useEffect(()=>()=>Te.current.forEach(P=>{window.clearTimeout(P)}),[]),E.useEffect(()=>()=>{var P,Y;(P=C.current)==null||P.abort(),(Y=R.current)==null||Y.abort()},[]),E.useEffect(()=>{!n||!ye||(async()=>{const P=await Ah(n);if(!G0.current){G0.current=!0;const Y=localStorage.getItem(Io.session)||"";if(qC()===null&&Y&&P.some(ae=>ae.id===Y)){Tu(Y);return}}xo()})()},[n,ye]),E.useEffect(()=>{const P=V0.current;P&&P.app===n&&(V0.current=null,Tu(P.sid))},[n]);function pB(P,Y){Hr(!1),P===n?Tu(Y):(V0.current={app:P,sid:Y},r(P))}async function Ah(P){try{const Y=await cv(P,ye),ae=await Promise.all(Y.map(de=>{var Se;return(Se=de.events)!=null&&Se.length?Promise.resolve(de):Km(P,ye,de.id)}));return i(ae),ae}catch(Y){return Be(String(Y)),[]}}function G_(){p||(Be(""),S(""),N("confirm"),_(!0))}function mB(){var P;(P=C.current)==null||P.abort(),C.current=null,_(!1),N("confirm"),S(""),!p&&j==="temporary"&&U("agent")}async function gB(){var Y;(Y=C.current)==null||Y.abort();const P=new AbortController;C.current=P,N("loading"),S("");try{const ae=await Gb.startSession({signal:P.signal});if(C.current!==P)return;Ye.current="",o(""),h([]),M(""),te(Xi()),U("temporary"),wa(),Q(!1),xa(ce),J([]),x([]),m(ae),vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),_(!1),N("confirm")}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||C.current!==P)return;S(ae instanceof Error?ae.message:String(ae)),N("error")}finally{C.current===P&&(C.current=null)}}function Eo(){var Y;(Y=R.current)==null||Y.abort(),R.current=null,w(!1),x([]),M(""),Be(""),U("agent");const P=p;m(null),P&&Gb.closeSession(P.id).catch(ae=>Be(String(ae)))}async function yB(P){var Se;const Y=p;if(!Y||y||!P.trim())return;Be("");const ae=new AbortController;(Se=R.current)==null||Se.abort(),R.current=ae;const de=[{role:"user",blocks:[{kind:"text",text:P}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];x(xe=>[...xe,...de]),w(!0);try{const xe=await Gb.sendMessage({sessionId:Y.id,text:P},{signal:ae.signal,onBlocks:Me=>{R.current===ae&&x(Ke=>{const Pe=Ke.slice(),jt=Pe[Pe.length-1];return(jt==null?void 0:jt.role)==="assistant"&&(Pe[Pe.length-1]={...jt,blocks:Me}),Pe})}});if(R.current!==ae)return;x(Me=>{const Ke=Me.slice(),Pe=Ke[Ke.length-1];return(Pe==null?void 0:Pe.role)==="assistant"&&(Ke[Ke.length-1]={...Pe,blocks:xe.blocks,meta:{ts:Date.now()/1e3}}),Ke})}catch(xe){if((xe==null?void 0:xe.name)==="AbortError"||R.current!==ae)return;x(Me=>Me.slice(0,-2)),M(P),Be(`内置智能体发送失败:${xe instanceof Error?xe.message:String(xe)}`)}finally{R.current===ae&&(R.current=null,w(!1))}}function xo(){Eo(),Be(""),be(!1),an(JC()),U("agent"),wa(),Q(!1);const P=a&&q.length===0&&ce.length>0?a:"";Ye.current="",o(""),Ie(null),Ge([]),d(!1),h([]),te(Xi()),xa(ce),J([]),P&&va(P)}function bB(P){$t.current!==null&&window.clearTimeout($t.current),un(P),$t.current=window.setTimeout(()=>{un(""),$t.current=null},3e3)}function EB(){if(vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),!n&&!p){Cr(!0),bB("请先选择 agent");return}Cr(!1),xo()}async function xB(P){var Y;try{(Y=he.current.get(P))==null||Y.abort(),await hE(n,ye,P),await fE(n,ye,P);const ae=Te.current.get(P);ae!==void 0&&window.clearTimeout(ae),Te.current.delete(P),ne(de=>{if(!de.has(P))return de;const Se=new Set(de);return Se.delete(P),Se}),F(de=>{const{[P]:Se,...xe}=de;return xe}),P===a&&xo(),await Ah(n)}catch(ae){Be(String(ae))}}async function Tu(P){if(p&&Eo(),P!==a&&(Ye.current=P,Be(""),d(!1),h([]),U("agent"),wa(),te(Xi()),Ie(null),Ge([]),o(P),O[P]===void 0)){en(!0);try{const Y=await Km(n,ye,P);D(P,_V(Y.events??[],Y.state))}catch(Y){Be(String(Y))}finally{en(!1)}}}async function wB(P){if(!P.sessionId||!P.messageId){Be("这条案例缺少会话定位信息,无法跳转。");return}Hr(!1),vt(null),lt(!1),yt(!1),pt(!1),pn(!1),z0(n),G5(P.kind),_h(P.messageId),await Tu(P.sessionId)}function vB(){const P=U_||n;Hr(!1),vt(null),lt(!1),yt(!1),pt(!1),vs(""),ts(P),_u("evaluations"),X5(Y5),pn(!0),z0(""),_h("")}function _B(P){const Y=new Map,ae=new Map;for(const de of P){if(!de.sessionId||!de.messageId)continue;const Se=Y.get(de.sessionId)??new Set;if(Se.add(de.messageId),Y.set(de.sessionId,Se),de.runtimeId&&de.userId){const xe=[de.runtimeId,n,de.userId,de.sessionId].join(":"),Me=ae.get(xe)??{runtimeId:de.runtimeId,appName:n,userId:de.userId,sessionId:de.sessionId,eventIds:new Set};Me.eventIds.add(de.messageId),ae.set(xe,Me)}}if(Y.size!==0){F(de=>{const Se={...de};for(const[xe,Me]of Y){const Ke=Se[xe];Ke&&(Se[xe]=Ke.map(Pe=>{var jt;return(jt=Pe.meta)!=null&&jt.eventId&&Me.has(Pe.meta.eventId)?{...Pe,meta:{...Pe.meta,feedback:void 0}}:Pe}))}return Se}),i(de=>de.map(Se=>{const xe=Y.get(Se.id);if(!xe||!Se.state)return Se;const Me={...Se.state};for(const Ke of xe)delete Me[`veadk_feedback:${Ke}`];return{...Se,state:Me}})),Fe(de=>{const Se=new Set(de);for(const xe of Y.values())for(const Me of xe)Se.delete(Me);return Se});for(const de of ae.values())fM({runtimeId:de.runtimeId,appName:de.appName,userId:de.userId,sessionId:de.sessionId,eventIds:[...de.eventIds]})}}async function W_(P=!0){if(a)return a;c.current||(c.current=Vm(n,ye));const Y=c.current;try{const ae=await Y;P&&o(ae);const de=Date.now()/1e3,Se={id:ae,lastUpdateTime:de,events:[]};return i(xe=>[Se,...xe.filter(Me=>Me.id!==ae)]),ae}finally{c.current===Y&&(c.current=null)}}async function q_(P){if(!n||!ye||!a||!Ne)return!1;xt(!0),Be("");try{const Y=await SM(n,ye,a,P,Ne.revision);return Ie(Y),!0}catch(Y){return Be(String(Y)),!1}finally{xt(!1)}}async function X_(P){if(!(!n||!ye||!a||!Ne)){xt(!0),Be("");try{const Y=await TM(n,ye,a,P,Ne.revision);Ie(Y)}catch(Y){Be(String(Y))}finally{xt(!1)}}}async function kB(P){Be("");let Y;try{Y=await W_()}catch(de){Be(String(de));return}const ae=Array.from(P).map(de=>({file:de,attachment:{id:Lbe(),mimeType:Mbe(de),name:de.name,sizeBytes:de.size,status:"uploading"}}));J(de=>[...de,...ae.map(Se=>Se.attachment)]),await Promise.all(ae.map(async({file:de,attachment:Se})=>{try{const xe=await EM(n,ye,Y,de);if(gt.current.delete(Se.id)){xe.uri&&await Gp(n,xe.uri);return}J(Me=>Me.map(Ke=>Ke.id===Se.id?xe:Ke))}catch(xe){if(gt.current.delete(Se.id))return;const Me=xe instanceof Error?xe.message:String(xe);J(Ke=>Ke.map(Pe=>Pe.id===Se.id?{...Pe,status:"error",error:Me}:Pe)),Be(Me)}}))}async function Q_(P,Y=[],ae=Xi()){if(!P.trim()&&Y.length===0||bi||po||!n||!ye)return;Be("");const de=[];(ae.skills.length>0||ae.targetAgent)&&de.push({kind:"invocation",value:ae}),Y.length&&de.push({kind:"attachment",files:Y.map(Pe=>({id:Pe.id,mimeType:Pe.mimeType,data:Pe.data,uri:Pe.uri,name:Pe.name,sizeBytes:Pe.sizeBytes}))}),P.trim()&&de.push({kind:"text",text:P});const Se=[{role:"user",blocks:de,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],xe=!a;xe&&(h(Se),d(!0));let Me;try{Me=await W_(!xe)}catch(Pe){xe&&(h([]),d(!1),M(P),te(ae)),Be(String(Pe));return}D(Me,Pe=>xe?Se:[...Pe,...Se]),xe&&(Ye.current=Me,o(Me),h([]),d(!1));const Ke=new AbortController;he.current.set(Me,Ke),He(Me,!0),qe(Me),Ye.current=Me,hn(Pe=>({...Pe,[Me]:""})),Kn(Pe=>({...Pe,[Me]:new Set})),yr(Pe=>({...Pe,[Me]:[]}));try{let Pe=si(),jt="",tt=0,ft=Date.now()/1e3,_n="",rs="";for await(const In of bf({appName:n,userId:ye,sessionId:Me,text:P,attachments:Y,invocation:ae,signal:Ke.signal,sessionCapabilities:Ne!==null})){if(Ke.signal.aborted)break;const Vi=In.error??In.errorMessage??In.error_message;if(typeof Vi=="string"&&Vi){Ye.current===Me&&Be(Vi);break}_a(Me,In);const Ki=In.author&&In.author!=="user"?In.author:"";Ki&&Ki!==jt&&(jt=Ki,Pe=si()),Pe=Pc(Pe,In);const wi=In.usageMetadata??In.usage_metadata;wi!=null&&wi.totalTokenCount&&(tt=wi.totalTokenCount),In.timestamp&&(ft=In.timestamp),In.id&&(_n=In.id);const Gn=In.invocationId??In.invocation_id;Gn&&(rs=Gn);const Ir=Pe.blocks,vi={author:jt||void 0,tokens:tt||void 0,ts:ft,eventId:_n||void 0,invocationId:rs||void 0};D(Me,Yi=>{var Gi;const dr=Yi.slice(),Na=dr[dr.length-1];return(Na==null?void 0:Na.role)==="assistant"&&(!((Gi=Na.meta)!=null&&Gi.author)||Na.meta.author===jt)?dr[dr.length-1]={...Na,blocks:Ir,meta:vi}:dr.push({role:"assistant",blocks:Ir,meta:vi}),dr})}Ah(n)}catch(Pe){(Pe==null?void 0:Pe.name)!=="AbortError"&&!Ke.signal.aborted&&Ye.current===Me&&Be(String(Pe))}finally{he.current.get(Me)===Ke&&he.current.delete(Me),He(Me,!1),Ut(Me),hn(Pe=>({...Pe,[Me]:""})),yr(Pe=>({...Pe,[Me]:[]}))}}function NB(P,Y){var Se,xe;const ae=((Se=P==null?void 0:P.event)==null?void 0:Se.name)??Y.id,de=((xe=P==null?void 0:P.event)==null?void 0:xe.context)??{};Q_(`[ui-action] ${ae}: ${JSON.stringify(de)}`)}async function SB(P){var Pe,jt,tt;if(!P.authUri)throw new Error("事件中没有授权地址。");if(!n||!ye||!a)throw new Error("会话尚未就绪。");const Y=a,ae=await Cbe(P.authUri),de=Ibe(P.authConfig,ae),Se=ft=>ft.map(_n=>_n.kind==="auth"&&!_n.done?{..._n,done:!0}:_n);D(Y,ft=>{const _n=ft.slice(),rs=_n[_n.length-1];return(rs==null?void 0:rs.role)==="assistant"&&(_n[_n.length-1]={...rs,blocks:Se(rs.blocks)}),_n});const xe=L[L.length-1],Me=Se(xe&&xe.role==="assistant"?xe.blocks:[]),Ke=new AbortController;he.current.set(Y,Ke),He(Y,!0),qe(Y);try{let ft=si(),_n=((Pe=xe==null?void 0:xe.meta)==null?void 0:Pe.author)??"",rs=Me,In=0,Vi=Date.now()/1e3,Ki=((jt=xe==null?void 0:xe.meta)==null?void 0:jt.eventId)??"",wi=((tt=xe==null?void 0:xe.meta)==null?void 0:tt.invocationId)??"";for await(const Gn of bf({appName:n,userId:ye,sessionId:a,text:"",functionResponses:[{id:P.callId,name:"adk_request_credential",response:de}],signal:Ke.signal,sessionCapabilities:Ne!==null})){if(Ke.signal.aborted)break;_a(Y,Gn);const Ir=Gn.author&&Gn.author!=="user"?Gn.author:"";Ir&&Ir!==_n&&(_n=Ir,rs=[],ft=si()),ft=Pc(ft,Gn);const vi=Gn.usageMetadata??Gn.usage_metadata;vi!=null&&vi.totalTokenCount&&(In=vi.totalTokenCount),Gn.timestamp&&(Vi=Gn.timestamp),Gn.id&&(Ki=Gn.id);const Yi=Gn.invocationId??Gn.invocation_id;Yi&&(wi=Yi);const dr=[...rs,...ft.blocks];D(Y,Na=>{var rk,sk,ik,ak,ok;const Gi=Na.slice(),tr=Gi[Gi.length-1],nk={author:_n||((rk=tr==null?void 0:tr.meta)==null?void 0:rk.author),tokens:In||((sk=tr==null?void 0:tr.meta)==null?void 0:sk.tokens),ts:Vi,eventId:Ki||((ik=tr==null?void 0:tr.meta)==null?void 0:ik.eventId),invocationId:wi||((ak=tr==null?void 0:tr.meta)==null?void 0:ak.invocationId)};return(tr==null?void 0:tr.role)==="assistant"&&(!((ok=tr.meta)!=null&&ok.author)||tr.meta.author===_n)?Gi[Gi.length-1]={...tr,blocks:dr,meta:nk}:Gi.push({role:"assistant",blocks:dr,meta:nk}),Gi})}Ah(n)}catch(ft){(ft==null?void 0:ft.name)!=="AbortError"&&!Ke.signal.aborted&&Ye.current===Y&&Be(String(ft))}finally{he.current.get(Y)===Ke&&he.current.delete(Y),He(Y,!1),Ut(Y),hn(ft=>({...ft,[Y]:""})),yr(ft=>({...ft,[Y]:[]}))}}if(_e)return l.jsxs("div",{className:"boot boot-error",children:[l.jsx("p",{children:_e}),l.jsx("button",{type:"button",onClick:J0,children:"重试"})]});if(Ht===null)return l.jsx("div",{className:"boot"});if(Ht==="unauthenticated")return l.jsx(sbe,{branding:Ft,onUsername:fB});if(!ot)return l.jsx("div",{className:"boot"});const Gs=ot.capabilities.createAgents,Z_=ot.capabilities.manageAgents,ks=Gs?Vs:null,Au=Gs&&Yn,Cu=Gs&&at,Iu=H0,J_=qM(e,Nu),Ru=J_.filter(P=>P.runtimeId&&(H_===null||H_.has(P.runtimeId))).map(P=>{var Y;return{...P,canDelete:P.runtimeId?((Y=J5[P.runtimeId])==null?void 0:Y.canDelete)===!0:!1}}),TB=(()=>{if(Ru.length===0)return Ru;const P=new Map(_l.map((Y,ae)=>[Y,ae]));return[...Ru].sort((Y,ae)=>{const de=P.get(Y.id),Se=P.get(ae.id);return de!=null&&Se!=null?de-Se:de!=null?-1:Se!=null?1:Ru.indexOf(Y)-Ru.indexOf(ae)})})(),Ch=P=>{var Y;return((Y=J_.find(ae=>ae.id===P))==null?void 0:Y.label)??P},ns=Nu.find(P=>P.runtimeId&&P.apps.some(Y=>Ja(P.id,Y)===n)),Nl=ns&&ns.runtimeId?{runtimeId:ns.runtimeId,name:ns.name,region:ns.region??"cn-beijing"}:void 0,ek=async(P,Y)=>{var Me,Ke;const ae=(Me=P.meta)==null?void 0:Me.eventId,de=a;if(!ae||!de||!Nl)return;const Se=(Ke=P.meta)==null?void 0:Ke.feedback,xe={...Se,rating:Y,syncStatus:"syncing",updatedAt:Date.now()/1e3};D(de,Pe=>Pe.map(jt=>{var tt;return((tt=jt.meta)==null?void 0:tt.eventId)===ae?{...jt,meta:{...jt.meta,feedback:xe}}:jt})),Fe(Pe=>new Set(Pe).add(ae));try{const Pe=await gM({appName:n,userId:ye,sessionId:de,eventId:ae,rating:Y});D(de,jt=>jt.map(tt=>{var ft;return((ft=tt.meta)==null?void 0:ft.eventId)===ae?{...tt,meta:{...tt.meta,feedback:Pe}}:tt})),i(jt=>jt.map(tt=>tt.id===de?{...tt,state:{...tt.state??{},[`veadk_feedback:${ae}`]:Pe}}:tt))}catch(Pe){D(de,jt=>jt.map(tt=>{var ft;return((ft=tt.meta)==null?void 0:ft.eventId)===ae?{...tt,meta:{...tt.meta,feedback:Se}}:tt})),Ye.current===de&&Be(Pe instanceof Error?Pe.message:String(Pe))}finally{Fe(Pe=>{const jt=new Set(Pe);return jt.delete(ae),jt})}},Ih=P=>{go(os()),Ye.current="",o(""),Cr(!1),r(P)},AB=()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}Cr(!1),pn(!1),Rt(null),vt(null),yt(!0),Be("")},CB=async P=>{if(P.runtime)try{const Y=await Ld(P.runtime.runtimeId,P.name,P.runtime.region,P.runtime.currentVersion);go(os()),Ys(null),Cr(!1),pn(!1),xo(),r(Y)}catch(Y){Be(Y instanceof Error?Y.message:String(Y))}},IB=P=>{P.runtime&&(Ys(P),vs(""),ts(""),Cr(!1),pn(!0),Be(""))},tk=()=>{p&&Eo(),Ye.current="",o(""),vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),vs(""),ts(""),Cr(!0),Be("")},RB=P=>{z0(""),_h(""),Ih(P)},OB=P=>{vs(""),ts(P),_u("basic"),Ih(P)},zi=_s!=null&&_s.runtime?{id:`detail:${_s.runtime.runtimeId}`,label:_s.name,app:_s.name,remote:!0,runtimeId:_s.runtime.runtimeId,region:_s.runtime.region,currentVersion:_s.runtime.currentVersion,canDelete:_s.runtime.canDelete}:null;return l.jsxs("div",{className:"layout",children:[l.jsx(zV,{branding:Ft,access:ot,features:Ze,sessions:s,currentSessionId:a,streamingSids:At,onNewChat:EB,onSearch:()=>{p&&Eo(),vt(null),pt(!1),lt(!1),yt(!1),pn(!1),Ys(null),Cr(!1),Hr(!0),Be("")},onQuickCreate:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}p&&Eo(),Ye.current="",o(""),pt(!1),lt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),vt(null),Rt(null),yt(!0),Be("")},onSkillCenter:()=>{p&&Eo(),vt(null),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),pt(!0),Be("")},onAddAgent:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}p&&Eo(),Ye.current="",vt(null),pt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),o(""),yt(!1),lt(!0),Be("")},onMyAgents:tk,onPickSession:P=>{vt(null),pt(!1),lt(!1),yt(!1),Hr(!1),pn(!1),Ys(null),Cr(!1),Be(""),Tu(P)},onDeleteSession:xB,userInfo:Qe,version:or,onLogout:hB}),(()=>{const P=l.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&l.jsx(Xye,{onExit:xo}),l.jsx(pme,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?Ch(n):"Agent",value:T,onChange:M,onSubmit:()=>{if(!p&&j==="skill-create"){const Se=T.trim();if(!Se||ie)return;const xe={id:`pending-${Date.now()}`,prompt:Se,status:"provisioning",candidates:x_.map((Ke,Pe)=>({id:`pending-${Pe}`,model:Ke,modelLabel:Ke,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};Q(!0);const Me=++ee.current;Be(""),B(xe),M(""),Nye(Se,Ke=>{ee.current===Me&&B(Ke)}).then(Ke=>{ee.current===Me&&B(Ke)}).catch(Ke=>{ee.current===Me&&(B(null),M(Se),Be(Ke instanceof Error?Ke.message:String(Ke)))}).finally(()=>{ee.current===Me&&Q(!1)});return}const Y=T;if(M(""),p){yB(Y);return}const ae=ce,de=fe;J([]),te(Xi()),Q_(Y,ae,de),Xb(ae)},disabled:p?!1:!ye||j==="temporary"||j==="agent"&&!n,busy:p?y:j==="skill-create"?ie:bi,showMeta:L.length>0&&!p,attachments:p?[]:ce,skills:p?[]:wl,agents:p?[]:vl,invocation:p?Xi():fe,capabilitiesLoading:!p&&Z,allowAttachments:!p,onInvocationChange:te,onAddFiles:kB,onRemoveAttachment:mo,newChatMode:p?"agent":j,newChatLayout:!p&&L.length===0&&W===null,showModeSelector:!1,temporaryEnabled:I.temporaryEnabled,skillCreateEnabled:I.skillCreateEnabled,onModeChange:Y=>{if(!(Y==="temporary"&&!I.temporaryEnabled||Y==="skill-create"&&!I.skillCreateEnabled)){if(Y==="temporary"){U(Y),G_();return}if(U(Y),Be(""),Y==="skill-create"){te(Xi());const ae=a&&q.length===0&&ce.length>0?a:"";xa(ce),J([]),ae&&(Ye.current="",o(""),va(ae))}}}})]});return l.jsxs("section",{className:"main-shell",children:[l.jsx(sK,{appName:n,onAppChange:Iu?OB:Ih,agentLabel:Ch,agentsSource:it,localApps:e,currentRuntime:Nl,runtimeScope:ot.capabilities.runtimeScope,onBrowseAgents:tk,title:p?"Codex 智能体":ku?"智能体":Au?"添加 Agent":Cu?"添加 AgentKit 智能体":Iu?_s?_s.name:Y0?Ch(Y0):"智能体详情":void 0,titleLeading:L.length>0&&!p&&j==="agent"&&!Au&&!Cu&&!$e&&!wh&&!Iu&&!ku&&ks===null&&n?l.jsx("button",{ref:Ve,type:"button",className:"agent-info-trigger","aria-label":"查看 Agent 信息",title:"Agent 信息","aria-expanded":_t,onClick:()=>be(!0),children:l.jsx(Bc,{})}):void 0,crumbs:$e?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:wh||Cu||Au||!ks?void 0:ks==="menu"?[{label:ybe,onClick:()=>{vt(null),Rt(null),yt(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>Nh(!0)},{label:bbe[ks]}],rightContent:l.jsxs(l.Fragment,{children:[ot.role==="admin"&&l.jsx(yye,{}),l.jsx(Obe,{tasks:Gs?z:[],onCancel:$})]})}),l.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[De&&l.jsx("div",{className:"error",children:De}),fn&&l.jsxs("div",{className:"session-loading",children:[l.jsx(Kt,{className:"icon spin"})," 加载会话…"]}),U_&&!Iu&&!Au&&!Cu&&!wh&&!$e&&ks===null&&l.jsx("div",{className:"case-return-bar",children:l.jsxs("button",{type:"button",onClick:vB,children:[l.jsx(qw,{"aria-hidden":!0}),l.jsx("span",{children:"返回评测案例"})]})}),ku?l.jsx(Spe,{onCreateAgent:AB,onCreateCodexAgent:G_,onUseAgent:CB,onViewAgentDetails:IB,connectedRuntimeId:Nl==null?void 0:Nl.runtimeId}):Iu?l.jsx(bpe,{agents:zi?[zi]:TB,drafts:cr,agentOrder:_l,selectedAgentId:n,agentInfo:ge,agentInfoAgentId:n,loadingAgentInfo:Z,canCreate:Gs,canUpdate:Gs||Z_,loadingAgents:Q5,agentsError:Z5,deploymentTasks:z,focusedDeploymentTaskId:V_,focusedAgentId:(zi==null?void 0:zi.id)??Y0,focusedAgentSection:W5,focusedCaseKind:q5,detailOnly:!!zi||!!V_,onRetryAgents:()=>void q0(),onAgentOrderChange:rB,onDeleteAgents:sB,onDeleteDrafts:nB,onSelectAgent:Ih,onTalkAgent:RB,onOpenFeedbackCase:Y=>void wB(Y),onFeedbackCasesDeleted:_B,onCreateAgent:()=>{if(!Gs){Be("当前账号没有添加 Agent 的权限。");return}pn(!1),yt(!0),vt(null),Rt(null),xi(null),Ks(""),ws.current=null,vs(""),ts(""),Be("")},onUpdateAgent:Y=>{if(!Z_&&!Gs){Be("当前账号没有管理 Agent 的权限。");return}if(!(ns!=null&&ns.runtimeId)){Be("仅支持更新已部署的云端智能体。");return}pn(!1),Rt(Y);const ae=`runtime-${ns.runtimeId}`;Ks(ae),ws.current=cr.find(de=>de.id===ae)??null,vs(""),ts(""),xi({runtimeId:ns.runtimeId,name:ns.name,region:ns.region??"cn-beijing",currentVersion:ns.currentVersion}),vt("custom"),Be("")},onEditDraft:Y=>{pn(!1),Rt(Y.draft),Ks(Y.id),ws.current=Y,xi(Y.deploymentTarget??null),vs(""),ts(""),vt("custom"),Be("")}},(zi==null?void 0:zi.id)??"workspace"):Au?l.jsx(_6,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:_be,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{yt(!1),Rt(null),vt("menu")}},{key:"package",icon:dz,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{yt(!1),Rt(null),vt("package")}}]}):wh?l.jsx(DV,{userId:ye,appId:n,agentInfo:ge,capabilitiesLoading:Z,agentLabel:Ch,onOpenSession:pB}):Cu?l.jsx(sse,{onAdded:Y=>{go(os()),lt(!1),r(Y)},onCancel:()=>lt(!1)}):$e?l.jsx(rse,{}):ks!==null&&!le?l.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:[l.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),l.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",l.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",l.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):ks==="menu"?l.jsx(Ige,{onSelect:Y=>{Rt(null),xi(null),vs(""),ts(""),Ks(Y==="custom"?`draft-${Date.now().toString(36)}`:""),ws.current=null,vt(Y)},onImport:Y=>{Rt(Y),xi(null),vs(""),ts(""),Ks(`draft-${Date.now().toString(36)}`),ws.current=null,vt("custom")}}):ks==="intelligent"?l.jsx(t0e,{userId:ye,onBack:()=>vt("menu"),onCreate:Th,onAgentAdded:X0,onDeploymentTaskChange:Ee}):ks==="custom"?l.jsx(K0e,{initialDraft:er??void 0,onBack:()=>vt("menu"),onCreate:Th,onAgentAdded:X0,features:Ze,onDeploymentTaskChange:Ee,deploymentTarget:kl??void 0,onDraftChange:(Y,ae)=>{$r&&(ae?tB($r,Y,kl??void 0):K_($r))},onDiscard:$r?()=>{K_($r),Ks(""),ws.current=null,Rt(null),xi(null),vs(""),ts(n),vt(null),yt(!1),pn(!0),Be("")}:void 0,onDeploymentStarted:iB,onDeploymentComplete:aB},$r||"custom"):ks==="template"?l.jsx(W0e,{onBack:()=>vt("menu"),onCreate:Th}):ks==="workflow"?l.jsx(nye,{onBack:()=>vt("menu"),onCreate:Th}):ks==="package"?l.jsx(oye,{onBack:()=>{vt(null),yt(!0)},onAgentAdded:X0,onDeploymentTaskChange:Ee}):L.length===0&&W?l.jsx(Uye,{initialJob:W}):L.length===0?l.jsxs("div",{className:"welcome",children:[l.jsx(pa,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":j==="skill-create"?"想创建一个什么 Skill?":sn}),P]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`transcript${Ei?" is-streaming":""}`,ref:Su,onScroll:oB,onWheel:lB,onTouchMove:cB,children:L.map((Y,ae)=>{var In,Vi,Ki,wi,Gn;const de=ae===L.length-1;if(Y.role==="user"){const Ir=Y.blocks.map(dr=>dr.kind==="text"?dr.text:"").join(""),vi=Y.blocks.flatMap(dr=>dr.kind==="attachment"?dr.files:[]),Yi=Y.blocks.find(dr=>dr.kind==="invocation");return l.jsxs(Wt.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Yi==null?void 0:Yi.kind)==="invocation"&&l.jsx(g_,{value:Yi.value}),vi.length>0&&l.jsx(b_,{appName:n,items:vi}),Ir&&l.jsx("div",{className:"bubble",children:l.jsx(sh,{text:Ir})}),l.jsxs("div",{className:"turn-actions turn-actions--right",children:[((In=Y.meta)==null?void 0:In.ts)&&l.jsx("span",{className:"meta-text",children:K5(Y.meta.ts)}),l.jsx(QC,{text:Ir})]})]},ae)}const Se=((Vi=Y.meta)==null?void 0:Vi.author)??"",xe=Se&&Jn?vx(Jn,Se):void 0,Me=!!(Se&&Ea.length>0&&!Ea.includes(Se)),Ke=(xe==null?void 0:xe.name)||Se,Pe=(xe==null?void 0:xe.description)||(Me?"正在执行主 Agent 移交的任务。":"");if(Y.blocks.length>0&&Y.blocks.every(Ir=>Ir.kind==="agent-transfer"))return null;const jt=Y.blocks.length===0,tt=((wi=(Ki=Y.meta)==null?void 0:Ki.feedback)==null?void 0:wi.rating)??null,ft=((Gn=Y.meta)==null?void 0:Gn.eventId)??"",_n=wn.has(ft),rs=!!(Nl&&ft&&XC(Y));return l.jsxs(Wt.div,{ref:Ir=>{ft&&(Ir?Q0.current.set(ft,Ir):Q0.current.delete(ft))},className:["turn turn--assistant",Me?"turn--subagent":"",vh===ft?"is-feedback-target":""].filter(Boolean).join(" "),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[Me&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"subagent-run-label",children:[l.jsxs("span",{className:"subagent-run-handoff",children:[l.jsx(oz,{}),l.jsx("span",{children:"智能体移交"})]}),l.jsx("span",{className:"subagent-run-title",children:Ke})]}),l.jsx("p",{className:"subagent-run-description",title:Pe,children:Pe})]}),jt?de&&xs?l.jsx(w6,{}):null:l.jsxs(l.Fragment,{children:[l.jsx(E_,{appName:n,blocks:Y.blocks,streaming:de&&(xs||Es),onStreamFrame:de?uB:void 0,onAction:NB,onAuth:SB}),!(de&&xs)&&!Tbe(Y)&&l.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(de&&xs)&&!Abe(Y)&&l.jsxs("div",{className:"turn-meta",children:[l.jsxs("div",{className:"turn-actions",children:[rs&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`icon-btn feedback-btn${tt==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":tt==="good","aria-busy":_n,title:tt==="good"?"取消点赞":"赞",disabled:_n,onClick:()=>void ek(Y,tt==="good"?null:"good"),children:l.jsx(Qye,{className:"icon",filled:tt==="good"})}),l.jsx("button",{type:"button",className:`icon-btn feedback-btn${tt==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":tt==="bad","aria-busy":_n,title:tt==="bad"?"取消点踩":"踩",disabled:_n,onClick:()=>void ek(Y,tt==="bad"?null:"bad"),children:l.jsx(Zye,{className:"icon",filled:tt==="bad"})})]}),!p&&l.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>Lt(!0),children:l.jsx(kbe,{})}),l.jsx(QC,{text:XC(Y)})]}),Y.meta&&l.jsx("span",{className:"meta-text",children:Nbe(Y.meta)})]})]})]},ae)})}),!p&&l.jsx(o3,{appName:n,info:ge,loading:Z,activeAgent:$i,seenAgents:Ur,execPath:Ar,capabilities:Ne,capabilityLoading:We,capabilityMutating:Xe,builtinTools:et,onAddCapability:q_,onRemoveCapability:Y=>void X_(Y)}),l.jsx("div",{className:"conversation-composer-slot",children:P})]})]})]})})(),dt&&a&&l.jsx(nbe,{appName:n,sessionId:a,onClose:()=>Lt(!1)}),_t&&L.length>0&&l.jsx(vK,{appName:n,info:ge,loading:Z,activeAgent:$i,seenAgents:Ur,execPath:Ar,capabilities:Ne,capabilityLoading:We,capabilityMutating:Xe,builtinTools:et,onAddCapability:q_,onRemoveCapability:P=>void X_(P),onClose:st,returnFocusRef:Ve}),l.jsx(qye,{open:b,state:k,error:A,onCancel:mB,onConfirm:()=>void gB()}),Ct&&l.jsx("div",{className:"app-toast",role:"status","aria-live":"polite",children:Ct}),l.jsx(ibe,{open:Bt,checking:vn,error:Ln,onLogin:()=>void dB()}),eB&&l.jsx("div",{className:"confirm-scrim",onClick:()=>Nh(!1),children:l.jsxs("div",{className:"confirm-box",onClick:P=>P.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),l.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{className:"confirm-btn",onClick:()=>Nh(!1),children:"取消"}),l.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{Rt(null),vt("menu"),Nh(!1)},children:"确定返回"})]})]})})]})}const eI="veadk.preloadRecoveryAt";window.addEventListener("vite:preloadError",e=>{const t=Date.now();let n=0;try{n=Number(sessionStorage.getItem(eI)||"0")}catch{}if(!(t-n<1e4)){e.preventDefault();try{sessionStorage.setItem(eI,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})()||Qb.createRoot(document.getElementById("root")).render(l.jsx(wt.StrictMode,{children:l.jsx(y9,{reducedMotion:"user",children:l.jsx(XH,{maskOpacity:.9,children:l.jsx(jbe,{})})})}));export{E as A,o0 as B,fs as C,Ube as D,Md as E,sl as F,X3 as G,Pbe as R,Sr as V,wt as a,Hc as b,KT as c,$be as d,vv as e,CW as f,vf as g,Dt as h,YX as i,JX as j,RW as k,Bf as l,JQ as m,MX as n,jX as o,oZ as p,TQ as q,AQ as r,oj as s,l as t,Je as u,Qt as v,St as w,Fbe as x,VX as y,Us as z}; diff --git a/veadk/webui/index.html b/veadk/webui/index.html index 0c0bf968..3ce0184c 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,7 +5,7 @@ VeADK Studio - +